pyfai-0.3.5/0000755001611600065110000000000011713243030011773 5ustar kieffersoftpyfai-0.3.5/README.TXT0000644001611600065110000000462411633462462013354 0ustar kieffersoftpyFAI ===== pyFAI is an azimuthal integration library that tries to be fast (as fast as C and even more using OpenCL) It is based on histogramming of the 2theta/Q position of each (center of) pixel weighted by the intensity of each pixel. Neighboring output bins get also a contribution of pixels next to the border Installation ============ pyFAI can be downloaded from the http://forge.epn-campus.eu/projects/azimuthal/files. Presently the source code has been distributed as a zip package and a compressed tarball. Download either one and unpack it. e.g. tar xvzf pyFAI-0.1.0.tar.gz or unzip pyFAI-0.1.0.zip all files are unpacked into the directory pyFAI-0.0.7. To install these do cd pyFAI-0.0.7 and install pyFAI with python setup.py install most likely you will need to do this with root privileges (e.g. put sudo in front of the command). The newest development version can be obtained by checking it out from the subversion (SVN) repository. Do svn checkout http://forge.epn-campus.eu/svn/azimuthal/pyFAI cd pyFAI sudo python setup.py install If you are using MS Windows you also download a binary version packaged as executable installation files (Chose the one corresponding to your python version). Dependencies ============ Python 2.5 or later should be compatible with python 3 For full functionality of pyFAI the following modules need to be installed. * numpy - http://www.numpy.org * scipy - http://www.scipy.org * matplotlib - http://matplotlib.sourceforge.net/ * fabio - http://sourceforge.net/projects/fable/files/fabio/ Ubuntu and Debian Like linux distributions: ------------------------------------------- To use pyFAI on Ubuntu (a linux distribution based on Debian) the needed python modules can be installed either through the Synaptic Package Manager (found in System -> Administration) or using apt-get on from the command line in a terminal. The extra ubuntu packages needed are: * python-numpy * python-scipy * python-matplotlib * python-dev Only Fabio has to be downloaded separatly and installed * python-fabio (from http://sourceforge.net/projects/fable/files/fabio/) using apt-get these can be installed as: sudo apt-get install python-numpy python-scipy python-matplotlib python-dev wget http://sourceforge.net/projects/fable/files/fabio/0.0.7/squeeze/python-fabio_0.0.7-1_amd64.deb/download sudo dpkg -i python-fabio_0.0.7-1_amd64.deb pyfai-0.3.5/setup.py0000644001611600065110000001413711705103306013515 0ustar kieffersoft#!/usr/bin/env python # -*- coding: utf8 -*- # # Project: Fast Azimuthal integration # https://forge.epn-campus.eu/projects/azimuthal # # File: "$Id$" # # Copyright (C) European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # """ Setup script for python Fast Azimuthal Integration """ __author__ = "Jerome Kieffer" __contact__ = "Jerome.Kieffer@ESRF.eu" __license__ = "GPLv3+" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" __date__ = "09/01/2012" __status__ = "stable" import os, sys, glob, imp, shutil try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension from numpy.distutils.misc_util import get_numpy_include_dirs from distutils.sysconfig import get_python_lib installDir = os.path.join(get_python_lib(), "pyFAI") hist_dic = dict(name="histogram", include_dirs=get_numpy_include_dirs(), sources=['src/histogram.c'], extra_compile_args=['-fopenmp'], extra_link_args=['-fopenmp'], ) split_dic = dict(name="splitPixel", include_dirs=get_numpy_include_dirs(), sources=['src/splitPixel.c'], # extra_compile_args=['-fopenmp'], # extra_link_args=['-fopenmp'], ) splitBBox_dic = dict(name="splitBBox", include_dirs=get_numpy_include_dirs(), sources=['src/splitBBox.c'])#, # extra_compile_args=['-fopenmp'], # extra_link_args=['-fopenmp']) relabel_dic = dict(name="relabel", include_dirs=get_numpy_include_dirs(), sources=['src/relabel.c']) bilinear_dic = dict(name="bilinear", include_dirs=get_numpy_include_dirs(), sources=['src/bilinear.c']) if sys.platform == "win32": data_files = [(installDir, [os.path.join("dll", "pthreadGC2.dll")])] ## Remove OpenMP for windows # to_remove = ["extra_compile_args", "extra_link_args"] # for ext in [hist_dic, split_dic, splitBBox_dic, relabel_dic, bilinear_dic]: # for rem in to_remove: # if rem in ext: # ext.pop(rem) root = os.path.dirname(os.path.abspath(__file__)) tocopy_files = [] script_files = [] for i in os.listdir(os.path.join(root, "scripts")): if os.path.isfile(os.path.join(root, "scripts", i)): if i.endswith(".py"): script_files.append(os.path.join("scripts", i)) else: tocopy_files.append(os.path.join("scripts", i)) for i in tocopy_files: filein = os.path.join(root, i) if (filein + ".py") not in script_files: shutil.copyfile(filein, filein + ".py") script_files.append(filein + ".py") else: data_files = [] script_files = glob.glob("scripts/*") print script_files version = [eval(l.split("=")[1]) for l in open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyFAI-src", "__init__.py")) if l.strip().startswith("version")][0] setup(name='pyFAI', version=version, author="Jérôme Kieffer (python), Peter Boesecke (geometry), Manuel Sanchez del Rio (algorithm), Vicente Armando Sole (algorithm) and Dimitris Karkoulis (GPU ) """, author_email="jerome.kieffer@esrf.fr", description='Python implementation of fast azimuthal integration', url="http://forge.epn-campus.eu/azimuthal", download_url="http://forge.epn-campus.eu/projects/azimuthal/files", ext_package="pyFAI", scripts=script_files, ext_modules=[Extension(**hist_dic) , Extension(**relabel_dic), Extension(**split_dic), Extension(**splitBBox_dic), Extension(**bilinear_dic)], packages=["pyFAI"], package_dir={"pyFAI": "pyFAI-src" }, # data_files=data_files, test_suite="test" ) ################################################################################ # Chech for Fabio to be present of the system ################################################################################ try: import fabio except ImportError: print("pyFAI needs fabIO for all image reading and writing. This python module can be found on: \nhttp://sourceforge.net/projects/fable/files/fabio/0.0.7/") ################################################################################ # check if OpenMP modules, freshly installed can import ################################################################################ pyFAI = None sys.path.insert(0, installDir) for loc in ["", ".", os.getcwd()]: if loc in sys.path: sys.path.pop(sys.path.index(loc)) for mod in sys.modules.copy(): if mod.startswith("pyFAI"): sys.modules.pop(mod) try: import pyFAI except ImportError as E: print("Unable to import pyFAI: %s" % E) else: print("PyFAI is installed in %s" % pyFAI.__file__) try: import pyFAI.histogram except ImportError as E: print("PyFAI.histogram failed to import. It is likely there is an OpenMP error: %s" % E) else: print("OpenMP libraries were found and pyFAI.histogram was successfully imported") pyfai-0.3.5/build-msi.bat0000755001611600065110000000022111643121540014351 0ustar kieffersoft@ECHO OFF REM Script that builds a msi package from this library c:\python26\python.exe setup.py build --force --compiler mingw32 bdist_msi pyfai-0.3.5/setup.cfg0000644001611600065110000000007311706351114013621 0ustar kieffersoft[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 pyfai-0.3.5/build-deb.sh0000755001611600065110000000035011633443447014176 0ustar kieffersoft#!/bin/sh # Script that builds a debian package from this library rm -rf deb_dist python setup.py --command-packages=stdeb.command bdist_deb #sudo dpkg -i deb_dist/python-pyfai*.deb sudo su -c "dpkg -i deb_dist/python-pyfai*" pyfai-0.3.5/TODO.txt0000644001611600065110000000031211706352005013302 0ustar kieffersoftTest 2D regrouping after alignment of images (with reference image from fit2d) dark & flat correction even for calibration (L. Erra id11) Write tools to create a mask (or recycle code from Armando) pyfai-0.3.5/src/0000755001611600065110000000000011713242747012600 5ustar kieffersoftpyfai-0.3.5/src/bilinear.c0000644001611600065110000067223711703641247014547 0ustar kieffersoft/* Generated by Cython 0.15.1+ on Wed Dec 21 21:48:02 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) #define CYTHON_PEP393_ENABLED #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #else #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__bilinear #define __PYX_HAVE_API__bilinear #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "bilinear.pyx", "numpy.pxd", }; /* "numpy.pxd":722 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":723 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":724 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":725 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":729 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":730 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":731 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":732 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":736 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":737 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":746 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":747 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":748 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":750 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":751 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":752 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":754 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":755 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":757 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":758 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":759 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "bilinear.pyx":35 * cimport numpy * import numpy * ctypedef numpy.float32_t DTYPE_float32_t # <<<<<<<<<<<<<< * * cdef extern from "math.h": */ typedef __pyx_t_5numpy_float32_t __pyx_t_8bilinear_DTYPE_float32_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ struct __pyx_obj_8bilinear_bilinear; /* "numpy.pxd":761 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":762 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":763 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":765 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; /* "bilinear.pyx":55 * * @cython.boundscheck(False) * cdef class bilinear: # <<<<<<<<<<<<<< * """Bilinear interpolator for finding max""" * */ struct __pyx_obj_8bilinear_bilinear { PyObject_HEAD float *data; float max; float min; long d0_max; long d1_max; long r; }; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; int is_complex; char enc_type; char new_packmode; char enc_packmode; } __Pyx_BufFmt_Context; static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (likely(i >= 0)) { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { return m->sq_item(o, i); } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[32]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'bilinear' */ static PyTypeObject *__pyx_ptype_8bilinear_ndarray = 0; static PyTypeObject *__pyx_ptype_8bilinear_bilinear = 0; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8bilinear_DTYPE_float32_t = { "DTYPE_float32_t", NULL, sizeof(__pyx_t_8bilinear_DTYPE_float32_t), 'R', 0, 0 }; #define __Pyx_MODULE_NAME "bilinear" int __pyx_module_is_main_bilinear = 0; /* Implementation of 'bilinear' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_2[] = "ndarray is not C contiguous"; static char __pyx_k_4[] = "ndarray is not Fortran contiguous"; static char __pyx_k_6[] = "Non-native byte order not supported"; static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_12[] = "Format string allocated too short."; static char __pyx_k_14[] = "Jerome Kieffer"; static char __pyx_k_15[] = "21/12/2011"; static char __pyx_k_16[] = "2011, ESRF"; static char __pyx_k_17[] = "jerome.kieffer@esrf.fr"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__max[] = "max"; static char __pyx_k__min[] = "min"; static char __pyx_k__data[] = "data"; static char __pyx_k__size[] = "size"; static char __pyx_k__GPLv3[] = "GPLv3"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__astype[] = "astype"; static char __pyx_k__float32[] = "float32"; static char __pyx_k____date__[] = "__date__"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____author__[] = "__author__"; static char __pyx_k____contact__[] = "__contact__"; static char __pyx_k____license__[] = "__license__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k____copyright__[] = "__copyright__"; static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_s_14; static PyObject *__pyx_kp_s_15; static PyObject *__pyx_kp_s_16; static PyObject *__pyx_kp_s_17; static PyObject *__pyx_kp_u_2; static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_6; static PyObject *__pyx_kp_u_8; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__GPLv3; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____author__; static PyObject *__pyx_n_s____contact__; static PyObject *__pyx_n_s____copyright__; static PyObject *__pyx_n_s____date__; static PyObject *__pyx_n_s____license__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__ascontiguousarray; static PyObject *__pyx_n_s__astype; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__float32; static PyObject *__pyx_n_s__max; static PyObject *__pyx_n_s__min; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__size; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_1; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_7; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_13; /* "bilinear.pyx":62 * cdef long d0_max, d1_max, r * * def __dealloc__(self): # <<<<<<<<<<<<<< * free(self.data) * */ static void __pyx_pf_8bilinear_8bilinear___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_8bilinear_8bilinear___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "bilinear.pyx":63 * * def __dealloc__(self): * free(self.data) # <<<<<<<<<<<<<< * * def __init__(self, numpy.ndarray data not None): */ free(((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data); __Pyx_RefNannyFinishContext(); } /* "bilinear.pyx":65 * free(self.data) * * def __init__(self, numpy.ndarray data not None): # <<<<<<<<<<<<<< * assert data.ndim == 2 * self.d0_max = data.shape[0] - 1 */ static int __pyx_pf_8bilinear_8bilinear_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8bilinear_8bilinear_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_data = 0; PyArrayObject *__pyx_v_data2 = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_data2; __Pyx_Buffer __pyx_pybuffer_data2; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; float __pyx_t_3; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; PyArrayObject *__pyx_t_6 = NULL; long __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,0}; __Pyx_RefNannySetupContext("__init__"); { 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: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); if (likely(values[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, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_data = ((PyArrayObject *)values[0]); } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_data = ((PyArrayObject *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bilinear.bilinear.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_pybuffer_data2.pybuffer.buf = NULL; __pyx_pybuffer_data2.refcount = 0; __pyx_pybuffernd_data2.data = NULL; __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":66 * * def __init__(self, numpy.ndarray data not None): * assert data.ndim == 2 # <<<<<<<<<<<<<< * self.d0_max = data.shape[0] - 1 * self.d1_max = data.shape[1] - 1 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_data->nd == 2))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "bilinear.pyx":67 * def __init__(self, numpy.ndarray data not None): * assert data.ndim == 2 * self.d0_max = data.shape[0] - 1 # <<<<<<<<<<<<<< * self.d1_max = data.shape[1] - 1 * self.r = data.shape[1] */ ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max = ((__pyx_v_data->dimensions[0]) - 1); /* "bilinear.pyx":68 * assert data.ndim == 2 * self.d0_max = data.shape[0] - 1 * self.d1_max = data.shape[1] - 1 # <<<<<<<<<<<<<< * self.r = data.shape[1] * self.max = data.max() */ ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max = ((__pyx_v_data->dimensions[1]) - 1); /* "bilinear.pyx":69 * self.d0_max = data.shape[0] - 1 * self.d1_max = data.shape[1] - 1 * self.r = data.shape[1] # <<<<<<<<<<<<<< * self.max = data.max() * self.min = data.min() */ ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r = (__pyx_v_data->dimensions[1]); /* "bilinear.pyx":70 * self.d1_max = data.shape[1] - 1 * self.r = data.shape[1] * self.max = data.max() # <<<<<<<<<<<<<< * self.min = data.min() * self.data = < float *> malloc(data.size * sizeof(float)) */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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 = 70; __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_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->max = __pyx_t_3; /* "bilinear.pyx":71 * self.r = data.shape[1] * self.max = data.max() * self.min = data.min() # <<<<<<<<<<<<<< * self.data = < float *> malloc(data.size * sizeof(float)) * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) */ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min = __pyx_t_3; /* "bilinear.pyx":72 * self.max = data.max() * self.min = data.min() * self.data = < float *> malloc(data.size * sizeof(float)) # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) * memcpy(self.data, data2.data, data.size * sizeof(float)) */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data = ((float *)malloc(__pyx_t_5)); /* "bilinear.pyx":73 * self.min = data.min() * self.data = < float *> malloc(data.size * sizeof(float)) * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) # <<<<<<<<<<<<<< * memcpy(self.data, data2.data, data.size * sizeof(float)) * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8bilinear_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_data2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_data2.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data2.diminfo[1].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data2.diminfo[1].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[1]; } } __pyx_t_6 = 0; __pyx_v_data2 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "bilinear.pyx":74 * self.data = < float *> malloc(data.size * sizeof(float)) * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) * memcpy(self.data, data2.data, data.size * sizeof(float)) # <<<<<<<<<<<<<< * * */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; memcpy(((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data, __pyx_v_data2->data, __pyx_t_7); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("bilinear.bilinear.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_data2); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "bilinear.pyx":77 * * * def f_cy(self, x): # <<<<<<<<<<<<<< * """ * Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates */ static PyObject *__pyx_pf_8bilinear_8bilinear_2f_cy(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ static char __pyx_doc_8bilinear_8bilinear_2f_cy[] = "\n Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates\n @param x: 2-tuple of float \n @return: Interpolated signal from the image (negative for minimizer)\n\n "; static PyObject *__pyx_pf_8bilinear_8bilinear_2f_cy(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { float __pyx_v_d0; float __pyx_v_d1; int __pyx_v_i0; int __pyx_v_i1; int __pyx_v_j0; int __pyx_v_j1; float __pyx_v_x0; float __pyx_v_x1; float __pyx_v_y0; float __pyx_v_y1; float __pyx_v_res; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; float __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("f_cy"); /* "bilinear.pyx":84 * * """ * cdef float d0 = x[0] # <<<<<<<<<<<<<< * cdef float d1 = x[1] * cdef int i0, i1, j0, j1 */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_d0 = __pyx_t_2; /* "bilinear.pyx":85 * """ * cdef float d0 = x[0] * cdef float d1 = x[1] # <<<<<<<<<<<<<< * cdef int i0, i1, j0, j1 * cdef float x0, x1, y0, y1, res */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_d1 = __pyx_t_2; /* "bilinear.pyx":88 * cdef int i0, i1, j0, j1 * cdef float x0, x1, y0, y1, res * x0 = floor(d0) # <<<<<<<<<<<<<< * x1 = ceil(d0) * y0 = floor(d1) */ __pyx_v_x0 = floor(__pyx_v_d0); /* "bilinear.pyx":89 * cdef float x0, x1, y0, y1, res * x0 = floor(d0) * x1 = ceil(d0) # <<<<<<<<<<<<<< * y0 = floor(d1) * y1 = ceil(d1) */ __pyx_v_x1 = ceil(__pyx_v_d0); /* "bilinear.pyx":90 * x0 = floor(d0) * x1 = ceil(d0) * y0 = floor(d1) # <<<<<<<<<<<<<< * y1 = ceil(d1) * i0 = < int > x0 */ __pyx_v_y0 = floor(__pyx_v_d1); /* "bilinear.pyx":91 * x1 = ceil(d0) * y0 = floor(d1) * y1 = ceil(d1) # <<<<<<<<<<<<<< * i0 = < int > x0 * i1 = < int > x1 */ __pyx_v_y1 = ceil(__pyx_v_d1); /* "bilinear.pyx":92 * y0 = floor(d1) * y1 = ceil(d1) * i0 = < int > x0 # <<<<<<<<<<<<<< * i1 = < int > x1 * j0 = < int > y0 */ __pyx_v_i0 = ((int)__pyx_v_x0); /* "bilinear.pyx":93 * y1 = ceil(d1) * i0 = < int > x0 * i1 = < int > x1 # <<<<<<<<<<<<<< * j0 = < int > y0 * j1 = < int > y1 */ __pyx_v_i1 = ((int)__pyx_v_x1); /* "bilinear.pyx":94 * i0 = < int > x0 * i1 = < int > x1 * j0 = < int > y0 # <<<<<<<<<<<<<< * j1 = < int > y1 * if d0 < 0: */ __pyx_v_j0 = ((int)__pyx_v_y0); /* "bilinear.pyx":95 * i1 = < int > x1 * j0 = < int > y0 * j1 = < int > y1 # <<<<<<<<<<<<<< * if d0 < 0: * res = self.min + d0 */ __pyx_v_j1 = ((int)__pyx_v_y1); /* "bilinear.pyx":96 * j0 = < int > y0 * j1 = < int > y1 * if d0 < 0: # <<<<<<<<<<<<<< * res = self.min + d0 * elif d1 < 0: */ __pyx_t_3 = (__pyx_v_d0 < 0.0); if (__pyx_t_3) { /* "bilinear.pyx":97 * j1 = < int > y1 * if d0 < 0: * res = self.min + d0 # <<<<<<<<<<<<<< * elif d1 < 0: * res = self.min + d1 */ __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min + __pyx_v_d0); goto __pyx_L5; } /* "bilinear.pyx":98 * if d0 < 0: * res = self.min + d0 * elif d1 < 0: # <<<<<<<<<<<<<< * res = self.min + d1 * elif d0 > self.d0_max: */ __pyx_t_3 = (__pyx_v_d1 < 0.0); if (__pyx_t_3) { /* "bilinear.pyx":99 * res = self.min + d0 * elif d1 < 0: * res = self.min + d1 # <<<<<<<<<<<<<< * elif d0 > self.d0_max: * res = self.min - d0 + self.d0_max */ __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min + __pyx_v_d1); goto __pyx_L5; } /* "bilinear.pyx":100 * elif d1 < 0: * res = self.min + d1 * elif d0 > self.d0_max: # <<<<<<<<<<<<<< * res = self.min - d0 + self.d0_max * elif d1 > self.d1_max: */ __pyx_t_3 = (__pyx_v_d0 > ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max); if (__pyx_t_3) { /* "bilinear.pyx":101 * res = self.min + d1 * elif d0 > self.d0_max: * res = self.min - d0 + self.d0_max # <<<<<<<<<<<<<< * elif d1 > self.d1_max: * res = self.min - d1 + self.d1_max */ __pyx_v_res = ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min - __pyx_v_d0) + ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max); goto __pyx_L5; } /* "bilinear.pyx":102 * elif d0 > self.d0_max: * res = self.min - d0 + self.d0_max * elif d1 > self.d1_max: # <<<<<<<<<<<<<< * res = self.min - d1 + self.d1_max * elif (i0 == i1) and (j0 == j1): */ __pyx_t_3 = (__pyx_v_d1 > ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max); if (__pyx_t_3) { /* "bilinear.pyx":103 * res = self.min - d0 + self.d0_max * elif d1 > self.d1_max: * res = self.min - d1 + self.d1_max # <<<<<<<<<<<<<< * elif (i0 == i1) and (j0 == j1): * res = self.data[i0 * self.r + j0] */ __pyx_v_res = ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min - __pyx_v_d1) + ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max); goto __pyx_L5; } /* "bilinear.pyx":104 * elif d1 > self.d1_max: * res = self.min - d1 + self.d1_max * elif (i0 == i1) and (j0 == j1): # <<<<<<<<<<<<<< * res = self.data[i0 * self.r + j0] * elif i0 == i1: */ __pyx_t_3 = (__pyx_v_i0 == __pyx_v_i1); if (__pyx_t_3) { __pyx_t_4 = (__pyx_v_j0 == __pyx_v_j1); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_3; } if (__pyx_t_5) { /* "bilinear.pyx":105 * res = self.min - d1 + self.d1_max * elif (i0 == i1) and (j0 == j1): * res = self.data[i0 * self.r + j0] # <<<<<<<<<<<<<< * elif i0 == i1: * res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) */ __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]); goto __pyx_L5; } /* "bilinear.pyx":106 * elif (i0 == i1) and (j0 == j1): * res = self.data[i0 * self.r + j0] * elif i0 == i1: # <<<<<<<<<<<<<< * res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) * elif j0 == j1: */ __pyx_t_5 = (__pyx_v_i0 == __pyx_v_i1); if (__pyx_t_5) { /* "bilinear.pyx":107 * res = self.data[i0 * self.r + j0] * elif i0 == i1: * res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) # <<<<<<<<<<<<<< * elif j0 == j1: * res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0)) */ __pyx_v_res = (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_y1 - __pyx_v_d1)) + ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_d1 - __pyx_v_y0))); goto __pyx_L5; } /* "bilinear.pyx":108 * elif i0 == i1: * res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) * elif j0 == j1: # <<<<<<<<<<<<<< * res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0)) * else: */ __pyx_t_5 = (__pyx_v_j0 == __pyx_v_j1); if (__pyx_t_5) { /* "bilinear.pyx":109 * res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) * elif j0 == j1: * res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0)) # <<<<<<<<<<<<<< * else: * res = (self.data[i0 * self.r + j0] * (x1 - d0) * (y1 - d1)) \ */ __pyx_v_res = (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_x1 - __pyx_v_d0)) + ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_d0 - __pyx_v_x0))); goto __pyx_L5; } /*else*/ { /* "bilinear.pyx":114 * + (self.data[i1 * self.r + j0] * (d0 - x0) * (y1 - d1)) \ * + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0)) \ * + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0)) # <<<<<<<<<<<<<< * return - res */ __pyx_v_res = ((((((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_x1 - __pyx_v_d0)) * (__pyx_v_y1 - __pyx_v_d1)) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_d0 - __pyx_v_x0)) * (__pyx_v_y1 - __pyx_v_d1))) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_x1 - __pyx_v_d0)) * (__pyx_v_d1 - __pyx_v_y0))) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_d0 - __pyx_v_x0)) * (__pyx_v_d1 - __pyx_v_y0))); } __pyx_L5:; /* "bilinear.pyx":115 * + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0)) \ * + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0)) * return - res # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_res)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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("bilinear.bilinear.f_cy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":193 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":199 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":202 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":203 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":205 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":207 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":208 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L6; } /*else*/ { /* "numpy.pxd":210 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L6:; /* "numpy.pxd":212 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":213 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":214 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":216 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":217 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":218 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":220 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":221 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":222 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":225 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":226 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":227 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":228 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); /* "numpy.pxd":229 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } goto __pyx_L9; } /*else*/ { /* "numpy.pxd":231 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":232 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } __pyx_L9:; /* "numpy.pxd":233 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":234 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":235 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":238 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":239 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; /* "numpy.pxd":243 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":245 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":247 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L12; } /*else*/ { /* "numpy.pxd":250 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L12:; /* "numpy.pxd":252 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":253 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; /* "numpy.pxd":254 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":255 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":256 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "numpy.pxd":257 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L15; } /* "numpy.pxd":258 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L15; } /* "numpy.pxd":259 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L15; } /* "numpy.pxd":260 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L15; } /* "numpy.pxd":261 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L15; } /* "numpy.pxd":262 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L15; } /* "numpy.pxd":263 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L15; } /* "numpy.pxd":264 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L15; } /* "numpy.pxd":265 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L15; } /* "numpy.pxd":266 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L15; } /* "numpy.pxd":267 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L15; } /* "numpy.pxd":268 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L15; } /* "numpy.pxd":269 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L15; } /* "numpy.pxd":270 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L15; } /* "numpy.pxd":271 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L15; } /* "numpy.pxd":272 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L15; } /* "numpy.pxd":273 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L15; } /*else*/ { /* "numpy.pxd":275 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L15:; /* "numpy.pxd":276 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":277 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":279 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = '^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":280 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":281 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":284 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":285 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = 0; } __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":287 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); /* "numpy.pxd":288 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { /* "numpy.pxd":289 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":290 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":291 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L6; } __pyx_L6:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":767 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":770 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":773 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":776 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":779 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); /* "numpy.pxd":780 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":782 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); /* "numpy.pxd":789 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":790 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":793 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":794 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":797 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "numpy.pxd":798 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":800 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; } else { __pyx_t_7 = __pyx_t_6; } if (!__pyx_t_7) { /* "numpy.pxd":801 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { __pyx_t_8 = (!__pyx_v_little_endian); __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { /* "numpy.pxd":802 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":812 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; /* "numpy.pxd":813 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":814 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":815 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } /* "numpy.pxd":817 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); /* "numpy.pxd":819 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { /* "numpy.pxd":820 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":821 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { /* "numpy.pxd":822 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "numpy.pxd":825 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } /* "numpy.pxd":826 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } /* "numpy.pxd":827 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } /* "numpy.pxd":828 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } /* "numpy.pxd":829 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } /* "numpy.pxd":830 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } /* "numpy.pxd":831 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } /* "numpy.pxd":832 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } /* "numpy.pxd":833 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } /* "numpy.pxd":834 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } /* "numpy.pxd":835 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } /* "numpy.pxd":836 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } /* "numpy.pxd":837 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } /* "numpy.pxd":838 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":839 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":840 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":841 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":843 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; /* "numpy.pxd":844 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { /* "numpy.pxd":848 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_11; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":849 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":964 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); /* "numpy.pxd":966 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":967 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":969 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":970 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":971 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":972 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":974 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); /* "numpy.pxd":975 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":976 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":978 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_8bilinear_bilinear(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; } static void __pyx_tp_dealloc_8bilinear_bilinear(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_8bilinear_8bilinear___dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_8bilinear_bilinear[] = { {__Pyx_NAMESTR("f_cy"), (PyCFunction)__pyx_pf_8bilinear_8bilinear_2f_cy, METH_O, __Pyx_DOCSTR(__pyx_doc_8bilinear_8bilinear_2f_cy)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_bilinear = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_bilinear = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_bilinear = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_bilinear = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_8bilinear_bilinear = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("bilinear.bilinear"), /*tp_name*/ sizeof(struct __pyx_obj_8bilinear_bilinear), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8bilinear_bilinear, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_bilinear, /*tp_as_number*/ &__pyx_tp_as_sequence_bilinear, /*tp_as_sequence*/ &__pyx_tp_as_mapping_bilinear, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_bilinear, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ __Pyx_DOCSTR("Bilinear interpolator for finding max"), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8bilinear_bilinear, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8bilinear_8bilinear_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8bilinear_bilinear, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("bilinear"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__GPLv3, __pyx_k__GPLv3, sizeof(__pyx_k__GPLv3), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1}, {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1}, {&__pyx_n_s____copyright__, __pyx_k____copyright__, sizeof(__pyx_k____copyright__), 0, 0, 1, 1}, {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1}, {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "bilinear.pyx":73 * self.min = data.min() * self.data = < float *> malloc(data.size * sizeof(float)) * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) # <<<<<<<<<<<<<< * memcpy(self.data, data2.data, data.size * sizeof(float)) * */ __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); /* "numpy.pxd":214 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "numpy.pxd":218 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); /* "numpy.pxd":256 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); /* "numpy.pxd":798 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":802 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "numpy.pxd":822 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initbilinear(void); /*proto*/ PyMODINIT_FUNC initbilinear(void) #else PyMODINIT_FUNC PyInit_bilinear(void); /*proto*/ PyMODINIT_FUNC PyInit_bilinear(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bilinear(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bilinear"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_bilinear) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_ptype_8bilinear_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_8bilinear_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyType_Ready(&__pyx_type_8bilinear_bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "bilinear", (PyObject *)&__pyx_type_8bilinear_bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8bilinear_bilinear = &__pyx_type_8bilinear_bilinear; /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "bilinear.pyx":26 * # * * __author__ = "Jerome Kieffer" # <<<<<<<<<<<<<< * __license__ = "GPLv3" * __date__ = "21/12/2011" */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":27 * * __author__ = "Jerome Kieffer" * __license__ = "GPLv3" # <<<<<<<<<<<<<< * __date__ = "21/12/2011" * __copyright__ = "2011, ESRF" */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_n_s__GPLv3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":28 * __author__ = "Jerome Kieffer" * __license__ = "GPLv3" * __date__ = "21/12/2011" # <<<<<<<<<<<<<< * __copyright__ = "2011, ESRF" * __contact__ = "jerome.kieffer@esrf.fr" */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":29 * __license__ = "GPLv3" * __date__ = "21/12/2011" * __copyright__ = "2011, ESRF" # <<<<<<<<<<<<<< * __contact__ = "jerome.kieffer@esrf.fr" * */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":30 * __date__ = "21/12/2011" * __copyright__ = "2011, ESRF" * __contact__ = "jerome.kieffer@esrf.fr" # <<<<<<<<<<<<<< * * import cython */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "bilinear.pyx":34 * import cython * cimport numpy * import numpy # <<<<<<<<<<<<<< * ctypedef numpy.float32_t DTYPE_float32_t * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); 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); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __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; /* "bilinear.pyx":1 * # -*- coding: utf8 -*- # <<<<<<<<<<<<<< * # * # Project: Azimuthal integration */ __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; /* "numpy.pxd":974 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init bilinear", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init bilinear"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'b': return "'char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset; if (ctx->enc_type == 0) return 0; group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } __Pyx_BufFmt_RaiseExpected(ctx); return -1; } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; } break; case '}': /* end of substruct; either repeat or move on */ ++ts; return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; default: { int number = __Pyx_BufFmt_ParseNumber(&ts); if (number == -1) { /* First char was not a digit */ PyErr_Format(PyExc_ValueError, "Does not understand character buffer dtype format string ('%c')", *ts); return NULL; } ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); else { PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject* obj = view->obj; if (obj) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); Py_DECREF(obj); view->obj = NULL; } } #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pyfai-0.3.5/src/splitBBox.html0000644001611600065110000160205511656557527015420 0ustar kieffersoft

Generated by Cython 0.15.1+ on Wed Nov 9 08:54:07 2011

Raw output: splitBBox.c

 1: #!/usr/bin/env python
  /* "splitBBox.pyx":1
 * #!/usr/bin/env python             # <<<<<<<<<<<<<<
 * # -*- coding: utf8 -*-
 * #
 */
  __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: utf8 -*-
 3: #
 4: #    Project: Azimuthal integration
 5: #             https://forge.epn-campus.eu/projects/azimuthal
 6: #
 7: #    File: "$Id$"
 8: #
 9: #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
 10: #
 11: #    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
 12: #
 13: #    This program is free software: you can redistribute it and/or modify
 14: #    it under the terms of the GNU General Public License as published by
 15: #    the Free Software Foundation, either version 3 of the License, or
 16: #    (at your option) any later version.
 17: #
 18: #    This program is distributed in the hope that it will be useful,
 19: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21: #    GNU General Public License for more details.
 22: #
 23: #    You should have received a copy of the GNU General Public License
 24: #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 25: #
 26: 
 27: 
 28: import cython
 29: cimport numpy
 30: import numpy
  /* "splitBBox.pyx":30
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h":
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 31: 
 32: cdef extern from "math.h":
 33:     double floor(float)nogil
 34: 
 35: 
 36: ctypedef numpy.int64_t DTYPE_int64_t
/* "splitBBox.pyx":36
 * 
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * ctypedef numpy.float32_t DTYPE_float32_t
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_9splitBBox_DTYPE_int64_t;
 37: ctypedef numpy.float64_t DTYPE_float64_t
/* "splitBBox.pyx":37
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t
 * ctypedef numpy.float64_t DTYPE_float64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float32_t DTYPE_float32_t
 * 
 */
typedef __pyx_t_5numpy_float64_t __pyx_t_9splitBBox_DTYPE_float64_t;
 38: ctypedef numpy.float32_t DTYPE_float32_t
 39: 
 40: 
 41: @cython.cdivision(True)
 42: cdef float  getBinNr(float x0, float pos0_min, float dpos) nogil:
/* "splitBBox.pyx":42
 * 
 * @cython.cdivision(True)
 * cdef float  getBinNr(float x0, float pos0_min, float dpos) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     calculate the bin number for any point
 */

static float __pyx_f_9splitBBox_getBinNr(float __pyx_v_x0, float __pyx_v_pos0_min, float __pyx_v_dpos) {
  float __pyx_r;
 43:     """
 44:     calculate the bin number for any point
 45:     param x0: current position
 46:     param pos0_min: position minimum
 47:     param dpos: bin width
 48:     """
 49:     return (x0 - pos0_min) / dpos
  /* "splitBBox.pyx":49
 *     param dpos: bin width
 *     """
 *     return (x0 - pos0_min) / dpos             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((__pyx_v_x0 - __pyx_v_pos0_min) / __pyx_v_dpos);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}
 50: 
 51: 
 52: @cython.cdivision(True)
 53: @cython.boundscheck(False)
 54: @cython.wraparound(False)
 55: def histoBBox1d(numpy.ndarray weights not None,
/* "splitBBox.pyx":55
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */

static PyObject *__pyx_pf_9splitBBox_histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9splitBBox_histoBBox1d[] = "\n    Calculates histogram of pos0 (tth) weighted by weights\n    \n    Splitting is done on the pixel's bounding box like fit2D\n    \n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! \n    @param bins: number of output bins\n    @param pos0Range: minimum and maximum  of the 2th range\n    @param pos1Range: minimum and maximum  of the chi range\n    @param dummy: value for bins without pixels \n    @return 2theta, I, weighted histogram, unweighted histogram\n    ";
static PyMethodDef __pyx_mdef_9splitBBox_histoBBox1d = {__Pyx_NAMESTR("histoBBox1d"), (PyCFunction)__pyx_pf_9splitBBox_histoBBox1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9splitBBox_histoBBox1d)};
static PyObject *__pyx_pf_9splitBBox_histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_weights = 0;
  PyArrayObject *__pyx_v_pos0 = 0;
  PyArrayObject *__pyx_v_delta_pos0 = 0;
  PyObject *__pyx_v_pos1 = 0;
  PyObject *__pyx_v_delta_pos1 = 0;
  long __pyx_v_bins;
  PyObject *__pyx_v_pos0Range = 0;
  PyObject *__pyx_v_pos1Range = 0;
  float __pyx_v_dummy;
  long __pyx_v_size;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_cpos0_inf = 0;
  PyArrayObject *__pyx_v_cpos0_sup = 0;
  PyArrayObject *__pyx_v_cpos1_inf = 0;
  PyArrayObject *__pyx_v_cpos1_sup = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_outPos = 0;
  float __pyx_v_deltaR;
  float __pyx_v_deltaL;
  float __pyx_v_deltaA;
  float __pyx_v_pos0_min;
  float __pyx_v_pos0_max;
  float __pyx_v_pos0_maxin;
  float __pyx_v_pos1_min;
  float __pyx_v_pos1_max;
  float __pyx_v_pos1_maxin;
  float __pyx_v_min0;
  float __pyx_v_max0;
  float __pyx_v_fbin0_min;
  float __pyx_v_fbin0_max;
  int __pyx_v_checkpos1;
  float __pyx_v_dpos;
  CYTHON_UNUSED long __pyx_v_bin;
  long __pyx_v_i;
  long __pyx_v_idx;
  long __pyx_v_bin0_max;
  long __pyx_v_bin0_min;
  double __pyx_v_epsilon;
  double __pyx_v_data;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
  __Pyx_Buffer __pyx_pybuffer_outMerge;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_inf;
  __Pyx_Buffer __pyx_pybuffer_cpos0_inf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outPos;
  __Pyx_Buffer __pyx_pybuffer_outPos;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_sup;
  __Pyx_Buffer __pyx_pybuffer_cpos0_sup;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_sup;
  __Pyx_Buffer __pyx_pybuffer_cpos1_sup;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
  __Pyx_Buffer __pyx_pybuffer_outCount;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata;
  __Pyx_Buffer __pyx_pybuffer_cdata;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
  __Pyx_Buffer __pyx_pybuffer_outData;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_inf;
  __Pyx_Buffer __pyx_pybuffer_cpos1_inf;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histoBBox1d");
  __pyx_self = __pyx_self;
  {
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

  /* "splitBBox.pyx":55
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */
  __pyx_k_tuple_24 = PyTuple_New(41); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_24);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 1, ((PyObject *)__pyx_n_s__pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 2, ((PyObject *)__pyx_n_s__delta_pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 3, ((PyObject *)__pyx_n_s__pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 4, ((PyObject *)__pyx_n_s__delta_pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 5, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 6, ((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 7, ((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 8, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 9, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 10, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_inf));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 11, ((PyObject *)__pyx_n_s__cpos0_inf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_inf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_sup));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 12, ((PyObject *)__pyx_n_s__cpos0_sup));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_sup));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_inf));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 13, ((PyObject *)__pyx_n_s__cpos1_inf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_inf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_sup));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 14, ((PyObject *)__pyx_n_s__cpos1_sup));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_sup));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 15, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 16, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 17, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 18, ((PyObject *)__pyx_n_s__outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 19, ((PyObject *)__pyx_n_s__deltaR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 20, ((PyObject *)__pyx_n_s__deltaL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 21, ((PyObject *)__pyx_n_s__deltaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 22, ((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 23, ((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 24, ((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 25, ((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 26, ((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 27, ((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 28, ((PyObject *)__pyx_n_s__min0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 29, ((PyObject *)__pyx_n_s__max0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 30, ((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 31, ((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__checkpos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 32, ((PyObject *)__pyx_n_s__checkpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__checkpos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 33, ((PyObject *)__pyx_n_s__dpos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 34, ((PyObject *)__pyx_n_s__bin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 35, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 36, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 37, ((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 38, ((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 39, ((PyObject *)__pyx_n_s__epsilon));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 40, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));

  /* "splitBBox.pyx":55
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_histoBBox1d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(9, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__histoBBox1d, 55, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 56:                 numpy.ndarray pos0 not None,
 57:                 numpy.ndarray delta_pos0 not None,
 58:                 pos1=None,
    /* "splitBBox.pyx":58
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 *                 pos1=None,             # <<<<<<<<<<<<<<
 *                 delta_pos1=None,
 *                 long bins=100,
 */
    values[3] = ((PyObject *)Py_None);
 59:                 delta_pos1=None,
    /* "splitBBox.pyx":59
 *                 numpy.ndarray delta_pos0 not None,
 *                 pos1=None,
 *                 delta_pos1=None,             # <<<<<<<<<<<<<<
 *                 long bins=100,
 *                 pos0Range=None,
 */
    values[4] = ((PyObject *)Py_None);
 60:                 long bins=100,
 61:                 pos0Range=None,
    /* "splitBBox.pyx":61
 *                 delta_pos1=None,
 *                 long bins=100,
 *                 pos0Range=None,             # <<<<<<<<<<<<<<
 *                 pos1Range=None,
 *                 float dummy=0.0
 */
    values[6] = ((PyObject *)Py_None);
 62:                 pos1Range=None,
    /* "splitBBox.pyx":62
 *                 long bins=100,
 *                 pos0Range=None,
 *                 pos1Range=None,             # <<<<<<<<<<<<<<
 *                 float dummy=0.0
 *               ):
 */
    values[7] = ((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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        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:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __pyx_v_weights = ((PyArrayObject *)values[0]);
      __pyx_v_pos0 = ((PyArrayObject *)values[1]);
      __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]);
      __pyx_v_pos1 = values[3];
      __pyx_v_delta_pos1 = values[4];
      if (values[5]) {
        __pyx_v_bins = __Pyx_PyInt_AsLong(values[5]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else {
        __pyx_v_bins = ((long)100);
      }
      __pyx_v_pos0Range = values[6];
      __pyx_v_pos1Range = values[7];
      if (values[8]) {
        __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else {
 63:                 float dummy=0.0
        /* "splitBBox.pyx":63
 *                 pos0Range=None,
 *                 pos1Range=None,
 *                 float dummy=0.0             # <<<<<<<<<<<<<<
 *               ):
 *     """
 */
        __pyx_v_dummy = ((float)0.0);
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        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);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_weights = ((PyArrayObject *)values[0]);
    __pyx_v_pos0 = ((PyArrayObject *)values[1]);
    __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]);
    __pyx_v_pos1 = values[3];
    __pyx_v_delta_pos1 = values[4];
    if (values[5]) {
      __pyx_v_bins = __Pyx_PyInt_AsLong(values[5]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_bins = ((long)100);
    }
    __pyx_v_pos0Range = values[6];
    __pyx_v_pos1Range = values[7];
    if (values[8]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_dummy = ((float)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("splitBBox.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_pybuffer_cdata.pybuffer.buf = NULL;
  __pyx_pybuffer_cdata.refcount = 0;
  __pyx_pybuffernd_cdata.data = NULL;
  __pyx_pybuffernd_cdata.rcbuffer = &__pyx_pybuffer_cdata;
  __pyx_pybuffer_cpos0_inf.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos0_inf.refcount = 0;
  __pyx_pybuffernd_cpos0_inf.data = NULL;
  __pyx_pybuffernd_cpos0_inf.rcbuffer = &__pyx_pybuffer_cpos0_inf;
  __pyx_pybuffer_cpos0_sup.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos0_sup.refcount = 0;
  __pyx_pybuffernd_cpos0_sup.data = NULL;
  __pyx_pybuffernd_cpos0_sup.rcbuffer = &__pyx_pybuffer_cpos0_sup;
  __pyx_pybuffer_cpos1_inf.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos1_inf.refcount = 0;
  __pyx_pybuffernd_cpos1_inf.data = NULL;
  __pyx_pybuffernd_cpos1_inf.rcbuffer = &__pyx_pybuffer_cpos1_inf;
  __pyx_pybuffer_cpos1_sup.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos1_sup.refcount = 0;
  __pyx_pybuffernd_cpos1_sup.data = NULL;
  __pyx_pybuffernd_cpos1_sup.rcbuffer = &__pyx_pybuffer_cpos1_sup;
  __pyx_pybuffer_outData.pybuffer.buf = NULL;
  __pyx_pybuffer_outData.refcount = 0;
  __pyx_pybuffernd_outData.data = NULL;
  __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData;
  __pyx_pybuffer_outCount.pybuffer.buf = NULL;
  __pyx_pybuffer_outCount.refcount = 0;
  __pyx_pybuffernd_outCount.data = NULL;
  __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount;
  __pyx_pybuffer_outMerge.pybuffer.buf = NULL;
  __pyx_pybuffer_outMerge.refcount = 0;
  __pyx_pybuffernd_outMerge.data = NULL;
  __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
  __pyx_pybuffer_outPos.pybuffer.buf = NULL;
  __pyx_pybuffer_outPos.refcount = 0;
  __pyx_pybuffernd_outPos.data = NULL;
  __pyx_pybuffernd_outPos.rcbuffer = &__pyx_pybuffer_outPos;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 64:               ):
 65:     """
 66:     Calculates histogram of pos0 (tth) weighted by weights
 67: 
 68:     Splitting is done on the pixel's bounding box like fit2D
 69: 
 70:     @param weights: array with intensities
 71:     @param pos0: 1D array with pos0: tth or q_vect
 72:     @param delta_pos0: 1D array with delta pos0: max center-corner distance
 73:     @param pos1: 1D array with pos1: chi
 74:     @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !
 75:     @param bins: number of output bins
 76:     @param pos0Range: minimum and maximum  of the 2th range
 77:     @param pos1Range: minimum and maximum  of the chi range
 78:     @param dummy: value for bins without pixels
 79:     @return 2theta, I, weighted histogram, unweighted histogram
 80:     """
 81:     cdef long  size = weights.size
  /* "splitBBox.pyx":81
 *     @return 2theta, I, weighted histogram, unweighted histogram
 *     """
 *     cdef long  size = weights.size             # <<<<<<<<<<<<<<
 *     assert pos0.size == size
 *     assert delta_pos0.size == size
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_size = __pyx_t_2;
 82:     assert pos0.size == size
  /* "splitBBox.pyx":82
 *     """
 *     cdef long  size = weights.size
 *     assert pos0.size == size             # <<<<<<<<<<<<<<
 *     assert delta_pos0.size == size
 *     assert  bins > 1
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 83:     assert delta_pos0.size == size
  /* "splitBBox.pyx":83
 *     cdef long  size = weights.size
 *     assert pos0.size == size
 *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
 *     assert  bins > 1
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 84:     assert  bins > 1
  /* "splitBBox.pyx":84
 *     assert pos0.size == size
 *     assert delta_pos0.size == size
 *     assert  bins > 1             # <<<<<<<<<<<<<<
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_bins > 1))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 85: 
 86:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
  /* "splitBBox.pyx":86
 *     assert  bins > 1
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "splitBBox.pyx":86
 *     assert  bins > 1
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 87:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
  /* "splitBBox.pyx":87
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos0_inf.diminfo[0].strides = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_inf.diminfo[0].shape = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_cpos0_inf = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "splitBBox.pyx":87
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 88:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
  /* "splitBBox.pyx":88
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos0_sup.diminfo[0].strides = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_sup.diminfo[0].shape = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_cpos0_sup = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "splitBBox.pyx":88
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_3);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 89:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
 90:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup
 91: 
 92:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
  /* "splitBBox.pyx":92
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;
 93:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
  /* "splitBBox.pyx":93
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32")
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 94:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")
  /* "splitBBox.pyx":94
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32")
 *     cdef float  deltaR, deltaL, deltaA
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 95:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32")
  /* "splitBBox.pyx":95
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32")             # <<<<<<<<<<<<<<
 *     cdef float  deltaR, deltaL, deltaA
 *     cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __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 = 95; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outPos.diminfo[0].strides = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outPos.diminfo[0].shape = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_outPos = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;
 96:     cdef float  deltaR, deltaL, deltaA
 97:     cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max
 98:     cdef int checkpos1 = 0
  /* "splitBBox.pyx":98
 *     cdef float  deltaR, deltaL, deltaA
 *     cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max
 *     cdef int checkpos1 = 0             # <<<<<<<<<<<<<<
 * 
 *     if pos0Range is not None and len(pos0Range) > 1:
 */
  __pyx_v_checkpos1 = 0;
 99: 
 100:     if pos0Range is not None and len(pos0Range) > 1:
  /* "splitBBox.pyx":100
 *     cdef int checkpos1 = 0
 * 
 *     if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
 *         pos0_min = min(pos0Range)
 *         if pos0_min < 0.0:
 */
  __pyx_t_5 = (__pyx_v_pos0Range != Py_None);
  if (__pyx_t_5) {
    __pyx_t_14 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = (__pyx_t_14 > 1);
    __pyx_t_16 = __pyx_t_15;
  } else {
    __pyx_t_16 = __pyx_t_5;
  }
  if (__pyx_t_16) {
 101:         pos0_min = min(pos0Range)
    /* "splitBBox.pyx":101
 * 
 *     if pos0Range is not None and len(pos0Range) > 1:
 *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
 *         if pos0_min < 0.0:
 *             pos0_min = 0.0
 */
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos0_min = __pyx_t_17;
 102:         if pos0_min < 0.0:
    /* "splitBBox.pyx":102
 *     if pos0Range is not None and len(pos0Range) > 1:
 *         pos0_min = min(pos0Range)
 *         if pos0_min < 0.0:             # <<<<<<<<<<<<<<
 *             pos0_min = 0.0
 *         pos0_maxin = max(pos0Range)
 */
    __pyx_t_16 = (__pyx_v_pos0_min < 0.0);
    if (__pyx_t_16) {
 103:             pos0_min = 0.0
      /* "splitBBox.pyx":103
 *         pos0_min = min(pos0Range)
 *         if pos0_min < 0.0:
 *             pos0_min = 0.0             # <<<<<<<<<<<<<<
 *         pos0_maxin = max(pos0Range)
 *     else:
 */
      __pyx_v_pos0_min = 0.0;
      goto __pyx_L7;
    }
    __pyx_L7:;
 104:         pos0_maxin = max(pos0Range)
    /* "splitBBox.pyx":104
 *         if pos0_min < 0.0:
 *             pos0_min = 0.0
 *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos0_min = cpos0_inf.min()
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_9 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_pos0_maxin = __pyx_t_17;
    goto __pyx_L6;
  }
  /*else*/ {
 105:     else:
 106:         pos0_min = cpos0_inf.min()
    /* "splitBBox.pyx":106
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = cpos0_inf.min()             # <<<<<<<<<<<<<<
 *         pos0_maxin = cpos0_sup.max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 */
    __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_inf), __pyx_n_s__min); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos0_min = __pyx_t_17;
 107:         pos0_maxin = cpos0_sup.max()
    /* "splitBBox.pyx":107
 *     else:
 *         pos0_min = cpos0_inf.min()
 *         pos0_maxin = cpos0_sup.max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_sup), __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_pos0_maxin = __pyx_t_17;
  }
  __pyx_L6:;
 108:     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
  /* "splitBBox.pyx":108
 *         pos0_min = cpos0_inf.min()
 *         pos0_maxin = cpos0_sup.max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 */
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__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 = 108; __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_pos0_max = __pyx_t_17;
 109: 
 110:     if pos1Range is not None and len(pos1Range) > 1:
  /* "splitBBox.pyx":110
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
 *         assert pos1.size == size
 *         assert delta_pos1.size == size
 */
  __pyx_t_16 = (__pyx_v_pos1Range != Py_None);
  if (__pyx_t_16) {
    __pyx_t_14 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_14 > 1);
    __pyx_t_15 = __pyx_t_5;
  } else {
    __pyx_t_15 = __pyx_t_16;
  }
  if (__pyx_t_15) {
 111:         assert pos1.size == size
    /* "splitBBox.pyx":111
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         assert pos1.size == size             # <<<<<<<<<<<<<<
 *         assert delta_pos1.size == size
 *         checkpos1 = 1
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_15)) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif
 112:         assert delta_pos1.size == size
    /* "splitBBox.pyx":112
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         assert pos1.size == size
 *         assert delta_pos1.size == size             # <<<<<<<<<<<<<<
 *         checkpos1 = 1
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    __pyx_t_9 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_15)) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif
 113:         checkpos1 = 1
    /* "splitBBox.pyx":113
 *         assert pos1.size == size
 *         assert delta_pos1.size == size
 *         checkpos1 = 1             # <<<<<<<<<<<<<<
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
 */
    __pyx_v_checkpos1 = 1;
 114:         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
    /* "splitBBox.pyx":114
 *         assert delta_pos1.size == size
 *         checkpos1 = 1
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
 *         pos1_min = min(pos1Range)
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __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_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_18 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer);
      __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_19 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_v_cpos1_inf, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
      }
      __pyx_pybuffernd_cpos1_inf.diminfo[0].strides = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_inf.diminfo[0].shape = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_18 = 0;
    __pyx_v_cpos1_inf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

  /* "splitBBox.pyx":114
 *         assert delta_pos1.size == size
 *         checkpos1 = 1
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
 *         pos1_min = min(pos1Range)
 */
  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_4);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 115:         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
    /* "splitBBox.pyx":115
 *         checkpos1 = 1
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer);
      __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_19 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_v_cpos1_sup, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
      }
      __pyx_pybuffernd_cpos1_sup.diminfo[0].strides = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_sup.diminfo[0].shape = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_23 = 0;
    __pyx_v_cpos1_sup = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

  /* "splitBBox.pyx":115
 *         checkpos1 = 1
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")             # <<<<<<<<<<<<<<
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 116:         pos1_min = min(pos1Range)
    /* "splitBBox.pyx":116
 *         cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
 *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
 *         pos1_maxin = max(pos1Range)
 *         pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_min = __pyx_t_17;
 117:         pos1_maxin = max(pos1Range)
    /* "splitBBox.pyx":117
 *         cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
 *         pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos1_maxin = __pyx_t_17;
 118:         pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
    /* "splitBBox.pyx":118
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 *         pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
 * 
 *     cdef float dpos = (pos0_max - pos0_min) / (< float > (bins))
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_max = __pyx_t_17;
    goto __pyx_L8;
  }
  __pyx_L8:;
 119: 
 120:     cdef float dpos = (pos0_max - pos0_min) / (< float > (bins))
  /* "splitBBox.pyx":120
 *         pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 *     cdef float dpos = (pos0_max - pos0_min) / (< float > (bins))             # <<<<<<<<<<<<<<
 *     cdef long   bin = 0
 *     cdef long   i, idx
 */
  __pyx_v_dpos = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins));
 121:     cdef long   bin = 0
  /* "splitBBox.pyx":121
 * 
 *     cdef float dpos = (pos0_max - pos0_min) / (< float > (bins))
 *     cdef long   bin = 0             # <<<<<<<<<<<<<<
 *     cdef long   i, idx
 *     cdef long   bin0_max, bin0_min
 */
  __pyx_v_bin = 0;
 122:     cdef long   i, idx
 123:     cdef long   bin0_max, bin0_min
 124:     cdef double epsilon = 1e-10
  /* "splitBBox.pyx":124
 *     cdef long   i, idx
 *     cdef long   bin0_max, bin0_min
 *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_epsilon = 1e-10;
 125: 
 126:     with nogil:
  /* "splitBBox.pyx":126
 *     cdef double epsilon = 1e-10
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "splitBBox.pyx":126
 *     cdef double epsilon = 1e-10
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
  }
 127:         for i in range(bins):
        /* "splitBBox.pyx":127
 * 
 *     with nogil:
 *         for i in range(bins):             # <<<<<<<<<<<<<<
 *                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos
 * 
 */
        __pyx_t_2 = __pyx_v_bins;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
          __pyx_v_i = __pyx_t_24;
 128:                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos
          /* "splitBBox.pyx":128
 *     with nogil:
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos             # <<<<<<<<<<<<<<
 * 
 *         for idx in range(size):
 */
          __pyx_t_25 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outPos.diminfo[0].strides) = (__pyx_v_pos0_min + ((0.5 + ((float)__pyx_v_i)) * __pyx_v_dpos));
        }
 129: 
 130:         for idx in range(size):
        /* "splitBBox.pyx":130
 *                 outPos[i] = pos0_min + (0.5 +< float > i) * dpos
 * 
 *         for idx in range(size):             # <<<<<<<<<<<<<<
 *             data = < double > cdata[idx]
 *             min0 = cpos0_inf[idx]
 */
        __pyx_t_2 = __pyx_v_size;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
          __pyx_v_idx = __pyx_t_24;
 131:             data = < double > cdata[idx]
          /* "splitBBox.pyx":131
 * 
 *         for idx in range(size):
 *             data = < double > cdata[idx]             # <<<<<<<<<<<<<<
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]
 */
          __pyx_t_26 = __pyx_v_idx;
          __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_cdata.diminfo[0].strides)));
 132:             min0 = cpos0_inf[idx]
          /* "splitBBox.pyx":132
 *         for idx in range(size):
 *             data = < double > cdata[idx]
 *             min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
 *             max0 = cpos0_sup[idx]
 *             if checkpos1:
 */
          __pyx_t_27 = __pyx_v_idx;
          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_cpos0_inf.diminfo[0].strides));
 133:             max0 = cpos0_sup[idx]
          /* "splitBBox.pyx":133
 *             data = < double > cdata[idx]
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
 *             if checkpos1:
 *                 if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):
 */
          __pyx_t_28 = __pyx_v_idx;
          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_cpos0_sup.diminfo[0].strides));
 134:             if checkpos1:
          /* "splitBBox.pyx":134
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]
 *             if checkpos1:             # <<<<<<<<<<<<<<
 *                 if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):
 *                     continue
 */
          if (__pyx_v_checkpos1) {
 135:                 if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):
            /* "splitBBox.pyx":135
 *             max0 = cpos0_sup[idx]
 *             if checkpos1:
 *                 if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
            __pyx_t_29 = __pyx_v_idx;
            __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_cpos1_inf.diminfo[0].strides)) < __pyx_v_pos1_min);
            if (!__pyx_t_15) {
              __pyx_t_30 = __pyx_v_idx;
              __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos1_sup.diminfo[0].strides)) > __pyx_v_pos1_max);
              __pyx_t_5 = __pyx_t_16;
            } else {
              __pyx_t_5 = __pyx_t_15;
            }
            if (__pyx_t_5) {
 136:                     continue
              /* "splitBBox.pyx":136
 *             if checkpos1:
 *                 if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 */
              goto __pyx_L14_continue;
              goto __pyx_L17;
            }
            __pyx_L17:;
            goto __pyx_L16;
          }
          __pyx_L16:;
 137: 
 138:             fbin0_min = getBinNr(min0, pos0_min, dpos)
          /* "splitBBox.pyx":138
 *                     continue
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)             # <<<<<<<<<<<<<<
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)
 */
          __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos);
 139:             fbin0_max = getBinNr(max0, pos0_min, dpos)
          /* "splitBBox.pyx":139
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)             # <<<<<<<<<<<<<<
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)
 */
          __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos);
 140:             bin0_min = < long > floor(fbin0_min)
          /* "splitBBox.pyx":140
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)             # <<<<<<<<<<<<<<
 *             bin0_max = < long > floor(fbin0_max)
 * 
 */
          __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min));
 141:             bin0_max = < long > floor(fbin0_max)
          /* "splitBBox.pyx":141
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)             # <<<<<<<<<<<<<<
 * 
 *             if bin0_min == bin0_max:
 */
          __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max));
 142: 
 143:             if bin0_min == bin0_max:
          /* "splitBBox.pyx":143
 *             bin0_max = < long > floor(fbin0_max)
 * 
 *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += < double > 1.0
 */
          __pyx_t_5 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
          if (__pyx_t_5) {
 144:                 #All pixel is within a single bin
 145:                 outCount[bin0_min] += < double > 1.0
            /* "splitBBox.pyx":145
 *             if bin0_min == bin0_max:
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += < double > 1.0             # <<<<<<<<<<<<<<
 *                 outData[bin0_min] += < double > data
 * 
 */
            __pyx_t_31 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_outCount.diminfo[0].strides) += ((double)1.0);
 146:                 outData[bin0_min] += < double > data
            /* "splitBBox.pyx":146
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += < double > 1.0
 *                 outData[bin0_min] += < double > data             # <<<<<<<<<<<<<<
 * 
 *             else: #we have pixel spliting.
 */
            __pyx_t_32 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_outData.diminfo[0].strides) += ((double)__pyx_v_data);
            goto __pyx_L18;
          }
          /*else*/ {
 147: 
 148:             else: #we have pixel spliting.
 149:                 deltaA = 1.0 / (fbin0_max - fbin0_min)
            /* "splitBBox.pyx":149
 * 
 *             else: #we have pixel spliting.
 *                 deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
 * 
 *                 deltaL = < float > (bin0_min + 1) - fbin0_min
 */
            __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
 150: 
 151:                 deltaL = < float > (bin0_min + 1) - fbin0_min
            /* "splitBBox.pyx":151
 *                 deltaA = 1.0 / (fbin0_max - fbin0_min)
 * 
 *                 deltaL = < float > (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
 *                 deltaR = fbin0_max - (< float > bin0_max)
 * 
 */
            __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 152:                 deltaR = fbin0_max - (< float > bin0_max)
            /* "splitBBox.pyx":152
 * 
 *                 deltaL = < float > (bin0_min + 1) - fbin0_min
 *                 deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
 * 
 *                 outCount[bin0_min] += < double > deltaA * deltaL
 */
            __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 153: 
 154:                 outCount[bin0_min] += < double > deltaA * deltaL
            /* "splitBBox.pyx":154
 *                 deltaR = fbin0_max - (< float > bin0_max)
 * 
 *                 outCount[bin0_min] += < double > deltaA * deltaL             # <<<<<<<<<<<<<<
 *                 outData[bin0_min] += < double > data * deltaA * deltaL
 * 
 */
            __pyx_t_33 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outCount.diminfo[0].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL);
 155:                 outData[bin0_min] += < double > data * deltaA * deltaL
            /* "splitBBox.pyx":155
 * 
 *                 outCount[bin0_min] += < double > deltaA * deltaL
 *                 outData[bin0_min] += < double > data * deltaA * deltaL             # <<<<<<<<<<<<<<
 * 
 *                 outCount[bin0_max] += < double > deltaA * deltaR
 */
            __pyx_t_34 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_outData.diminfo[0].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL);
 156: 
 157:                 outCount[bin0_max] += < double > deltaA * deltaR
            /* "splitBBox.pyx":157
 *                 outData[bin0_min] += < double > data * deltaA * deltaL
 * 
 *                 outCount[bin0_max] += < double > deltaA * deltaR             # <<<<<<<<<<<<<<
 *                 outData[bin0_max] += < double > data * deltaA * deltaR
 * 
 */
            __pyx_t_35 = __pyx_v_bin0_max;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_outCount.diminfo[0].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR);
 158:                 outData[bin0_max] += < double > data * deltaA * deltaR
            /* "splitBBox.pyx":158
 * 
 *                 outCount[bin0_max] += < double > deltaA * deltaR
 *                 outData[bin0_max] += < double > data * deltaA * deltaR             # <<<<<<<<<<<<<<
 * 
 *                 if bin0_min + 1 < bin0_max:
 */
            __pyx_t_36 = __pyx_v_bin0_max;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_outData.diminfo[0].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR);
 159: 
 160:                 if bin0_min + 1 < bin0_max:
            /* "splitBBox.pyx":160
 *                 outData[bin0_max] += < double > data * deltaA * deltaR
 * 
 *                 if bin0_min + 1 < bin0_max:             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += < double > deltaA
 */
            __pyx_t_5 = ((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max);
            if (__pyx_t_5) {
 161:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitBBox.pyx":161
 * 
 *                 if bin0_min + 1 < bin0_max:
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                         outCount[i] += < double > deltaA
 *                         outData[i] += data * < double > deltaA
 */
              __pyx_t_37 = __pyx_v_bin0_max;
              for (__pyx_t_38 = (__pyx_v_bin0_min + 1); __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) {
                __pyx_v_i = __pyx_t_38;
 162:                         outCount[i] += < double > deltaA
                /* "splitBBox.pyx":162
 *                 if bin0_min + 1 < bin0_max:
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += < double > deltaA             # <<<<<<<<<<<<<<
 *                         outData[i] += data * < double > deltaA
 * 
 */
                __pyx_t_39 = __pyx_v_i;
                *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount.diminfo[0].strides) += ((double)__pyx_v_deltaA);
 163:                         outData[i] += data * < double > deltaA
                /* "splitBBox.pyx":163
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += < double > deltaA
 *                         outData[i] += data * < double > deltaA             # <<<<<<<<<<<<<<
 * 
 *         for i in range(bins):
 */
                __pyx_t_40 = __pyx_v_i;
                *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_outData.diminfo[0].strides) += (__pyx_v_data * ((double)__pyx_v_deltaA));
              }
              goto __pyx_L19;
            }
            __pyx_L19:;
          }
          __pyx_L18:;
          __pyx_L14_continue:;
        }
 164: 
 165:         for i in range(bins):
        /* "splitBBox.pyx":165
 *                         outData[i] += data * < double > deltaA
 * 
 *         for i in range(bins):             # <<<<<<<<<<<<<<
 *                 if outCount[i] > epsilon:
 *                     outMerge[i] = < float > (outData[i] / outCount[i])
 */
        __pyx_t_2 = __pyx_v_bins;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
          __pyx_v_i = __pyx_t_24;
 166:                 if outCount[i] > epsilon:
          /* "splitBBox.pyx":166
 * 
 *         for i in range(bins):
 *                 if outCount[i] > epsilon:             # <<<<<<<<<<<<<<
 *                     outMerge[i] = < float > (outData[i] / outCount[i])
 *                 else:
 */
          __pyx_t_37 = __pyx_v_i;
          __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon);
          if (__pyx_t_5) {
 167:                     outMerge[i] = < float > (outData[i] / outCount[i])
            /* "splitBBox.pyx":167
 *         for i in range(bins):
 *                 if outCount[i] > epsilon:
 *                     outMerge[i] = < float > (outData[i] / outCount[i])             # <<<<<<<<<<<<<<
 *                 else:
 *                     outMerge[i] = dummy
 */
            __pyx_t_38 = __pyx_v_i;
            __pyx_t_41 = __pyx_v_i;
            __pyx_t_42 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_outMerge.diminfo[0].strides) = ((float)((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_outData.diminfo[0].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_outCount.diminfo[0].strides))));
            goto __pyx_L24;
          }
          /*else*/ {
 168:                 else:
 169:                     outMerge[i] = dummy
            /* "splitBBox.pyx":169
 *                     outMerge[i] = < float > (outData[i] / outCount[i])
 *                 else:
 *                     outMerge[i] = dummy             # <<<<<<<<<<<<<<
 * 
 *     return  outPos, outMerge, outData, outCount
 */
            __pyx_t_43 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outMerge.diminfo[0].strides) = __pyx_v_dummy;
          }
          __pyx_L24:;
        }
      }
 170: 
 171:     return  outPos, outMerge, outData, outCount
  /* "splitBBox.pyx":171
 *                     outMerge[i] = dummy
 * 
 *     return  outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_outPos));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos));
  __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
  __pyx_r = ((PyObject *)__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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("splitBBox.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_inf);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_sup);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_inf);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_sup);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_outPos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 172: 
 173: 
 174: 
 175: 
 176: @cython.cdivision(True)
 177: @cython.boundscheck(False)
 178: @cython.wraparound(False)
 179: def histoBBox2d(numpy.ndarray weights not None,
/* "splitBBox.pyx":179
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */

static PyObject *__pyx_pf_9splitBBox_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9splitBBox_1histoBBox2d[] = "\n    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights\n    \n    Splitting is done on the pixel's bounding box like fit2D\n    \n\n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! \n    @param bins: number of output bins (tth=100, chi=36 by default)\n    @param pos0Range: minimum and maximum  of the 2th range\n    @param pos1Range: minimum and maximum  of the chi range\n    @param dummy: value for bins without pixels \n    @return 2theta, I, weighted histogram, unweighted histogram\n    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n    ";
static PyMethodDef __pyx_mdef_9splitBBox_1histoBBox2d = {__Pyx_NAMESTR("histoBBox2d"), (PyCFunction)__pyx_pf_9splitBBox_1histoBBox2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9splitBBox_1histoBBox2d)};
static PyObject *__pyx_pf_9splitBBox_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_weights = 0;
  PyArrayObject *__pyx_v_pos0 = 0;
  PyArrayObject *__pyx_v_delta_pos0 = 0;
  PyArrayObject *__pyx_v_pos1 = 0;
  PyArrayObject *__pyx_v_delta_pos1 = 0;
  PyObject *__pyx_v_bins = 0;
  PyObject *__pyx_v_pos0Range = 0;
  PyObject *__pyx_v_pos1Range = 0;
  float __pyx_v_dummy;
  long __pyx_v_bins0;
  long __pyx_v_bins1;
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_v_idx;
  long __pyx_v_size;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_cpos0 = 0;
  PyArrayObject *__pyx_v_cdelta_pos0 = 0;
  PyArrayObject *__pyx_v_cpos0_inf = 0;
  PyArrayObject *__pyx_v_cpos0_sup = 0;
  PyArrayObject *__pyx_v_cpos1 = 0;
  PyArrayObject *__pyx_v_cdelta_pos1 = 0;
  PyArrayObject *__pyx_v_cpos1_inf = 0;
  PyArrayObject *__pyx_v_cpos1_sup = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_edges0 = 0;
  PyArrayObject *__pyx_v_edges1 = 0;
  float __pyx_v_min0;
  float __pyx_v_max0;
  float __pyx_v_min1;
  float __pyx_v_max1;
  float __pyx_v_deltaR;
  float __pyx_v_deltaL;
  float __pyx_v_deltaU;
  float __pyx_v_deltaD;
  float __pyx_v_deltaA;
  float __pyx_v_tmp;
  float __pyx_v_pos0_min;
  float __pyx_v_pos0_max;
  float __pyx_v_pos1_min;
  float __pyx_v_pos1_max;
  float __pyx_v_pos0_maxin;
  float __pyx_v_pos1_maxin;
  float __pyx_v_fbin0_min;
  float __pyx_v_fbin0_max;
  float __pyx_v_fbin1_min;
  float __pyx_v_fbin1_max;
  long __pyx_v_bin0_max;
  long __pyx_v_bin0_min;
  long __pyx_v_bin1_max;
  long __pyx_v_bin1_min;
  double __pyx_v_epsilon;
  double __pyx_v_data;
  float __pyx_v_dpos0;
  float __pyx_v_dpos1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
  __Pyx_Buffer __pyx_pybuffer_outMerge;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_inf;
  __Pyx_Buffer __pyx_pybuffer_cpos0_inf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cdelta_pos1;
  __Pyx_Buffer __pyx_pybuffer_cdelta_pos1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cdelta_pos0;
  __Pyx_Buffer __pyx_pybuffer_cdelta_pos0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_edges0;
  __Pyx_Buffer __pyx_pybuffer_edges0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_sup;
  __Pyx_Buffer __pyx_pybuffer_cpos0_sup;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_edges1;
  __Pyx_Buffer __pyx_pybuffer_edges1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_sup;
  __Pyx_Buffer __pyx_pybuffer_cpos1_sup;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
  __Pyx_Buffer __pyx_pybuffer_outCount;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata;
  __Pyx_Buffer __pyx_pybuffer_cdata;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1;
  __Pyx_Buffer __pyx_pybuffer_cpos1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0;
  __Pyx_Buffer __pyx_pybuffer_cpos0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
  __Pyx_Buffer __pyx_pybuffer_outData;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_inf;
  __Pyx_Buffer __pyx_pybuffer_cpos1_inf;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histoBBox2d");
  __pyx_self = __pyx_self;
  {
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

  /* "splitBBox.pyx":179
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */
  __pyx_k_tuple_27 = PyTuple_New(57); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_27);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 2, ((PyObject *)__pyx_n_s__delta_pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 3, ((PyObject *)__pyx_n_s__pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 4, ((PyObject *)__pyx_n_s__delta_pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 5, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 6, ((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 7, ((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 8, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 9, ((PyObject *)__pyx_n_s__bins0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 10, ((PyObject *)__pyx_n_s__bins1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 11, ((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_27, 12, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 13, ((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_27, 14, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 15, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 16, ((PyObject *)__pyx_n_s__cpos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdelta_pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 17, ((PyObject *)__pyx_n_s__cdelta_pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdelta_pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_inf));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 18, ((PyObject *)__pyx_n_s__cpos0_inf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_inf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_sup));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 19, ((PyObject *)__pyx_n_s__cpos0_sup));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_sup));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 20, ((PyObject *)__pyx_n_s__cpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdelta_pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 21, ((PyObject *)__pyx_n_s__cdelta_pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdelta_pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_inf));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 22, ((PyObject *)__pyx_n_s__cpos1_inf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_inf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_sup));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 23, ((PyObject *)__pyx_n_s__cpos1_sup));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_sup));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 24, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 25, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 26, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 27, ((PyObject *)__pyx_n_s__edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 28, ((PyObject *)__pyx_n_s__edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 29, ((PyObject *)__pyx_n_s__min0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 30, ((PyObject *)__pyx_n_s__max0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 31, ((PyObject *)__pyx_n_s__min1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 32, ((PyObject *)__pyx_n_s__max1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 33, ((PyObject *)__pyx_n_s__deltaR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 34, ((PyObject *)__pyx_n_s__deltaL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 35, ((PyObject *)__pyx_n_s__deltaU));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 36, ((PyObject *)__pyx_n_s__deltaD));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 37, ((PyObject *)__pyx_n_s__deltaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 38, ((PyObject *)__pyx_n_s__tmp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 39, ((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 40, ((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 41, ((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 42, ((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 43, ((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 44, ((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 45, ((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 46, ((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 47, ((PyObject *)__pyx_n_s__fbin1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 48, ((PyObject *)__pyx_n_s__fbin1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 49, ((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 50, ((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 51, ((PyObject *)__pyx_n_s__bin1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 52, ((PyObject *)__pyx_n_s__bin1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 53, ((PyObject *)__pyx_n_s__epsilon));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 54, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 55, ((PyObject *)__pyx_n_s__dpos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 56, ((PyObject *)__pyx_n_s__dpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "splitBBox.pyx":179
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos0 not None,
 *                 numpy.ndarray delta_pos0 not None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_1histoBBox2d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 180:                 numpy.ndarray pos0 not None,
 181:                 numpy.ndarray delta_pos0 not None,
 182:                 numpy.ndarray pos1 not None,
 183:                 numpy.ndarray delta_pos1 not None,
 184:                 bins=(100, 36),
    /* "splitBBox.pyx":184
 *                 numpy.ndarray pos1 not None,
 *                 numpy.ndarray delta_pos1 not None,
 *                 bins=(100, 36),             # <<<<<<<<<<<<<<
 *                 pos0Range=None,
 *                 pos1Range=None,
 */
    values[5] = ((PyObject *)__pyx_k_tuple_6);

  /* "splitBBox.pyx":184
 *                 numpy.ndarray pos1 not None,
 *                 numpy.ndarray delta_pos1 not None,
 *                 bins=(100, 36),             # <<<<<<<<<<<<<<
 *                 pos0Range=None,
 *                 pos1Range=None,
 */
  __pyx_k_tuple_6 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_6);
  __Pyx_INCREF(__pyx_int_100);
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_100);
  __Pyx_GIVEREF(__pyx_int_100);
  __Pyx_INCREF(__pyx_int_36);
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 1, __pyx_int_36);
  __Pyx_GIVEREF(__pyx_int_36);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 185:                 pos0Range=None,
    /* "splitBBox.pyx":185
 *                 numpy.ndarray delta_pos1 not None,
 *                 bins=(100, 36),
 *                 pos0Range=None,             # <<<<<<<<<<<<<<
 *                 pos1Range=None,
 *                 float dummy=0.0):
 */
    values[6] = ((PyObject *)Py_None);
 186:                 pos1Range=None,
    /* "splitBBox.pyx":186
 *                 bins=(100, 36),
 *                 pos0Range=None,
 *                 pos1Range=None,             # <<<<<<<<<<<<<<
 *                 float dummy=0.0):
 *     """
 */
    values[7] = ((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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        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:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __pyx_v_weights = ((PyArrayObject *)values[0]);
      __pyx_v_pos0 = ((PyArrayObject *)values[1]);
      __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]);
      __pyx_v_pos1 = ((PyArrayObject *)values[3]);
      __pyx_v_delta_pos1 = ((PyArrayObject *)values[4]);
      __pyx_v_bins = values[5];
      __pyx_v_pos0Range = values[6];
      __pyx_v_pos1Range = values[7];
      if (values[8]) {
        __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else {
 187:                 float dummy=0.0):
        /* "splitBBox.pyx":187
 *                 pos0Range=None,
 *                 pos1Range=None,
 *                 float dummy=0.0):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
 */
        __pyx_v_dummy = ((float)0.0);
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        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);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_weights = ((PyArrayObject *)values[0]);
    __pyx_v_pos0 = ((PyArrayObject *)values[1]);
    __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]);
    __pyx_v_pos1 = ((PyArrayObject *)values[3]);
    __pyx_v_delta_pos1 = ((PyArrayObject *)values[4]);
    __pyx_v_bins = values[5];
    __pyx_v_pos0Range = values[6];
    __pyx_v_pos1Range = values[7];
    if (values[8]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_dummy = ((float)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_pybuffer_cdata.pybuffer.buf = NULL;
  __pyx_pybuffer_cdata.refcount = 0;
  __pyx_pybuffernd_cdata.data = NULL;
  __pyx_pybuffernd_cdata.rcbuffer = &__pyx_pybuffer_cdata;
  __pyx_pybuffer_cpos0.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos0.refcount = 0;
  __pyx_pybuffernd_cpos0.data = NULL;
  __pyx_pybuffernd_cpos0.rcbuffer = &__pyx_pybuffer_cpos0;
  __pyx_pybuffer_cdelta_pos0.pybuffer.buf = NULL;
  __pyx_pybuffer_cdelta_pos0.refcount = 0;
  __pyx_pybuffernd_cdelta_pos0.data = NULL;
  __pyx_pybuffernd_cdelta_pos0.rcbuffer = &__pyx_pybuffer_cdelta_pos0;
  __pyx_pybuffer_cpos0_inf.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos0_inf.refcount = 0;
  __pyx_pybuffernd_cpos0_inf.data = NULL;
  __pyx_pybuffernd_cpos0_inf.rcbuffer = &__pyx_pybuffer_cpos0_inf;
  __pyx_pybuffer_cpos0_sup.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos0_sup.refcount = 0;
  __pyx_pybuffernd_cpos0_sup.data = NULL;
  __pyx_pybuffernd_cpos0_sup.rcbuffer = &__pyx_pybuffer_cpos0_sup;
  __pyx_pybuffer_cpos1.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos1.refcount = 0;
  __pyx_pybuffernd_cpos1.data = NULL;
  __pyx_pybuffernd_cpos1.rcbuffer = &__pyx_pybuffer_cpos1;
  __pyx_pybuffer_cdelta_pos1.pybuffer.buf = NULL;
  __pyx_pybuffer_cdelta_pos1.refcount = 0;
  __pyx_pybuffernd_cdelta_pos1.data = NULL;
  __pyx_pybuffernd_cdelta_pos1.rcbuffer = &__pyx_pybuffer_cdelta_pos1;
  __pyx_pybuffer_cpos1_inf.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos1_inf.refcount = 0;
  __pyx_pybuffernd_cpos1_inf.data = NULL;
  __pyx_pybuffernd_cpos1_inf.rcbuffer = &__pyx_pybuffer_cpos1_inf;
  __pyx_pybuffer_cpos1_sup.pybuffer.buf = NULL;
  __pyx_pybuffer_cpos1_sup.refcount = 0;
  __pyx_pybuffernd_cpos1_sup.data = NULL;
  __pyx_pybuffernd_cpos1_sup.rcbuffer = &__pyx_pybuffer_cpos1_sup;
  __pyx_pybuffer_outData.pybuffer.buf = NULL;
  __pyx_pybuffer_outData.refcount = 0;
  __pyx_pybuffernd_outData.data = NULL;
  __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData;
  __pyx_pybuffer_outCount.pybuffer.buf = NULL;
  __pyx_pybuffer_outCount.refcount = 0;
  __pyx_pybuffernd_outCount.data = NULL;
  __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount;
  __pyx_pybuffer_outMerge.pybuffer.buf = NULL;
  __pyx_pybuffer_outMerge.refcount = 0;
  __pyx_pybuffernd_outMerge.data = NULL;
  __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
  __pyx_pybuffer_edges0.pybuffer.buf = NULL;
  __pyx_pybuffer_edges0.refcount = 0;
  __pyx_pybuffernd_edges0.data = NULL;
  __pyx_pybuffernd_edges0.rcbuffer = &__pyx_pybuffer_edges0;
  __pyx_pybuffer_edges1.pybuffer.buf = NULL;
  __pyx_pybuffer_edges1.refcount = 0;
  __pyx_pybuffernd_edges1.data = NULL;
  __pyx_pybuffernd_edges1.rcbuffer = &__pyx_pybuffer_edges1;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos1), __pyx_ptype_5numpy_ndarray, 0, "pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos1), __pyx_ptype_5numpy_ndarray, 0, "delta_pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 188:     """
 189:     Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
 190: 
 191:     Splitting is done on the pixel's bounding box like fit2D
 192: 
 193: 
 194:     @param weights: array with intensities
 195:     @param pos0: 1D array with pos0: tth or q_vect
 196:     @param delta_pos0: 1D array with delta pos0: max center-corner distance
 197:     @param pos1: 1D array with pos1: chi
 198:     @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !
 199:     @param bins: number of output bins (tth=100, chi=36 by default)
 200:     @param pos0Range: minimum and maximum  of the 2th range
 201:     @param pos1Range: minimum and maximum  of the chi range
 202:     @param dummy: value for bins without pixels
 203:     @return 2theta, I, weighted histogram, unweighted histogram
 204:     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
 205:     """
 206: 
 207:     cdef long  bins0, bins1, i, j, idx
 208:     cdef long  size = weights.size
  /* "splitBBox.pyx":208
 * 
 *     cdef long  bins0, bins1, i, j, idx
 *     cdef long  size = weights.size             # <<<<<<<<<<<<<<
 *     assert pos0.size == size
 *     assert pos1.size == size
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_size = __pyx_t_2;
 209:     assert pos0.size == size
  /* "splitBBox.pyx":209
 *     cdef long  bins0, bins1, i, j, idx
 *     cdef long  size = weights.size
 *     assert pos0.size == size             # <<<<<<<<<<<<<<
 *     assert pos1.size == size
 *     assert delta_pos0.size == size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 210:     assert pos1.size == size
  /* "splitBBox.pyx":210
 *     cdef long  size = weights.size
 *     assert pos0.size == size
 *     assert pos1.size == size             # <<<<<<<<<<<<<<
 *     assert delta_pos0.size == size
 *     assert delta_pos1.size == size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 211:     assert delta_pos0.size == size
  /* "splitBBox.pyx":211
 *     assert pos0.size == size
 *     assert pos1.size == size
 *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
 *     assert delta_pos1.size == size
 *     try:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 212:     assert delta_pos1.size == size
  /* "splitBBox.pyx":212
 *     assert pos1.size == size
 *     assert delta_pos0.size == size
 *     assert delta_pos1.size == size             # <<<<<<<<<<<<<<
 *     try:
 *         bins0, bins1 = tuple(bins)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 213:     try:
  /* "splitBBox.pyx":213
 *     assert delta_pos0.size == size
 *     assert delta_pos1.size == size
 *     try:             # <<<<<<<<<<<<<<
 *         bins0, bins1 = tuple(bins)
 *     except:
 */
  {
    __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:*/ {
 214:         bins0, bins1 = tuple(bins)
      /* "splitBBox.pyx":214
 *     assert delta_pos1.size == size
 *     try:
 *         bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
 *     except:
 *         bins0 = bins1 = < long > bins
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_bins);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bins);
      __Pyx_GIVEREF(__pyx_v_bins);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (likely(PyTuple_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_3, 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      }
      __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_bins0 = __pyx_t_2;
      __pyx_v_bins1 = __pyx_t_9;
    }
    __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_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 215:     except:
    /* "splitBBox.pyx":215
 *     try:
 *         bins0, bins1 = tuple(bins)
 *     except:             # <<<<<<<<<<<<<<
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:
 */
    /*except:*/ {
      __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_1);
 216:         bins0 = bins1 = < long > bins
      /* "splitBBox.pyx":216
 *         bins0, bins1 = tuple(bins)
 *     except:
 *         bins0 = bins1 = < long > bins             # <<<<<<<<<<<<<<
 *     if bins0 <= 0:
 *         bins0 = 1
 */
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __pyx_v_bins0 = ((long)__pyx_t_9);
      __pyx_v_bins1 = ((long)__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_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_L7_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_L13_try_end:;
  }
 217:     if bins0 <= 0:
  /* "splitBBox.pyx":217
 *     except:
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:             # <<<<<<<<<<<<<<
 *         bins0 = 1
 *     if bins1 <= 0:
 */
  __pyx_t_5 = (__pyx_v_bins0 <= 0);
  if (__pyx_t_5) {
 218:         bins0 = 1
    /* "splitBBox.pyx":218
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:
 *         bins0 = 1             # <<<<<<<<<<<<<<
 *     if bins1 <= 0:
 *         bins1 = 1
 */
    __pyx_v_bins0 = 1;
    goto __pyx_L16;
  }
  __pyx_L16:;
 219:     if bins1 <= 0:
  /* "splitBBox.pyx":219
 *     if bins0 <= 0:
 *         bins0 = 1
 *     if bins1 <= 0:             # <<<<<<<<<<<<<<
 *         bins1 = 1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 */
  __pyx_t_5 = (__pyx_v_bins1 <= 0);
  if (__pyx_t_5) {
 220:         bins1 = 1
    /* "splitBBox.pyx":220
 *         bins0 = 1
 *     if bins1 <= 0:
 *         bins1 = 1             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 */
    __pyx_v_bins1 = 1;
    goto __pyx_L17;
  }
  __pyx_L17:;
 221:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
  /* "splitBBox.pyx":221
 *     if bins1 <= 0:
 *         bins1 = 1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "splitBBox.pyx":221
 *     if bins1 <= 0:
 *         bins1 = 1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 */
  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
 222:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
  /* "splitBBox.pyx":222
 *         bins1 = 1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __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__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos0.diminfo[0].strides = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0.diminfo[0].shape = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "splitBBox.pyx":222
 *         bins1 = 1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 */
  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_8);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 223:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
  /* "splitBBox.pyx":223
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdelta_pos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cdelta_pos0.diminfo[0].strides = __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdelta_pos0.diminfo[0].shape = __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_cdelta_pos0 = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "splitBBox.pyx":223
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 */
  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_9);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 224:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
  /* "splitBBox.pyx":224
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
 */
  __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_cpos0), ((PyObject *)__pyx_v_cdelta_pos0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos0_inf.diminfo[0].strides = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_inf.diminfo[0].shape = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_cpos0_inf = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 225:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
  /* "splitBBox.pyx":225
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
 */
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_cpos0), ((PyObject *)__pyx_v_cdelta_pos0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos0_sup.diminfo[0].strides = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_sup.diminfo[0].shape = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_14 = 0;
  __pyx_v_cpos0_sup = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 226:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
  /* "splitBBox.pyx":226
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __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__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos1.diminfo[0].strides = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1.diminfo[0].shape = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_15 = 0;
  __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "splitBBox.pyx":226
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_10);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 227:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
  /* "splitBBox.pyx":227
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdelta_pos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cdelta_pos1.diminfo[0].strides = __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdelta_pos1.diminfo[0].shape = __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_16 = 0;
  __pyx_v_cdelta_pos1 = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "splitBBox.pyx":227
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
 */
  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_11);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 228:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
  /* "splitBBox.pyx":228
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_cpos1), ((PyObject *)__pyx_v_cdelta_pos1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos1_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos1_inf.diminfo[0].strides = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_inf.diminfo[0].shape = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_17 = 0;
  __pyx_v_cpos1_inf = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 229:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
  /* "splitBBox.pyx":229
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_cpos1), ((PyObject *)__pyx_v_cdelta_pos1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_18 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos1_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_cpos1_sup.diminfo[0].strides = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_sup.diminfo[0].shape = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_18 = 0;
  __pyx_v_cpos1_sup = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 230:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
  /* "splitBBox.pyx":230
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_19));
  __pyx_t_19 = 0;
  __pyx_t_19 = PyDict_New(); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_19));
  if (PyDict_SetItem(__pyx_t_19, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_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;
  __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outData.diminfo[1].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outData.diminfo[1].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_20 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 231:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
  /* "splitBBox.pyx":231
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_19 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outCount.diminfo[1].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outCount.diminfo[1].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_21 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 232:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
  /* "splitBBox.pyx":232
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_19));
  __pyx_t_19 = 0;
  __pyx_t_19 = PyDict_New(); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_19));
  if (PyDict_SetItem(__pyx_t_19, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_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;
  __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMerge.diminfo[1].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMerge.diminfo[1].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_22 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 233:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")
  /* "splitBBox.pyx":233
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32")
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_19 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_23 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edges0.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_edges0.diminfo[0].strides = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges0.diminfo[0].shape = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_23 = 0;
  __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 234:     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32")
  /* "splitBBox.pyx":234
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")
 *     cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32")             # <<<<<<<<<<<<<<
 * 
 *     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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 = 234; __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 = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_19) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_19, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_24 = ((PyArrayObject *)__pyx_t_19);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edges1.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_edges1.diminfo[0].strides = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges1.diminfo[0].shape = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_24 = 0;
  __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_19);
  __pyx_t_19 = 0;
 235: 
 236:     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp
 237:     cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
 238:     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max
 239:     cdef long  bin0_max, bin0_min, bin1_max, bin1_min
 240:     cdef double epsilon = 1e-10
  /* "splitBBox.pyx":240
 *     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max
 *     cdef long  bin0_max, bin0_min, bin1_max, bin1_min
 *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
 *     cdef double data
 * 
 */
  __pyx_v_epsilon = 1e-10;
 241:     cdef double data
 242: 
 243:     if pos0Range is not None and len(pos0Range) == 2:
  /* "splitBBox.pyx":243
 *     cdef double data
 * 
 *     if pos0Range is not None and len(pos0Range) == 2:             # <<<<<<<<<<<<<<
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)
 */
  __pyx_t_5 = (__pyx_v_pos0Range != Py_None);
  if (__pyx_t_5) {
    __pyx_t_25 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_26 = (__pyx_t_25 == 2);
    __pyx_t_27 = __pyx_t_26;
  } else {
    __pyx_t_27 = __pyx_t_5;
  }
  if (__pyx_t_27) {
 244:         pos0_min = min(pos0Range)
    /* "splitBBox.pyx":244
 * 
 *     if pos0Range is not None and len(pos0Range) == 2:
 *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
 *         pos0_maxin = max(pos0Range)
 *     else:
 */
    __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos0_min = __pyx_t_28;
 245:         pos0_maxin = max(pos0Range)
    /* "splitBBox.pyx":245
 *     if pos0Range is not None and len(pos0Range) == 2:
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos0_min = max(0.0, cpos0_inf.min())
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_19 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_v_pos0_maxin = __pyx_t_28;
    goto __pyx_L18;
  }
  /*else*/ {
 246:     else:
 247:         pos0_min = max(0.0, cpos0_inf.min())
    /* "splitBBox.pyx":247
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = max(0.0, cpos0_inf.min())             # <<<<<<<<<<<<<<
 *         pos0_maxin = cpos0_sup.max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 */
    __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_inf), __pyx_n_s__min); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_29 = 0.0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_27 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_27) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_19 = __pyx_t_1;
    } else {
      __pyx_t_4 = PyFloat_FromDouble(__pyx_t_29); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_19 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_v_pos0_min = __pyx_t_28;
 248:         pos0_maxin = cpos0_sup.max()
    /* "splitBBox.pyx":248
 *     else:
 *         pos0_min = max(0.0, cpos0_inf.min())
 *         pos0_maxin = cpos0_sup.max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 */
    __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_sup), __pyx_n_s__max); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos0_maxin = __pyx_t_28;
  }
  __pyx_L18:;
 249:     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
  /* "splitBBox.pyx":249
 *         pos0_min = max(0.0, cpos0_inf.min())
 *         pos0_maxin = cpos0_sup.max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_19, __pyx_n_s__finfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_19, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
  __pyx_t_19 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_19); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_v_pos0_max = __pyx_t_28;
 250: 
 251:     if pos1Range is not None and len(pos1Range) > 1:
  /* "splitBBox.pyx":251
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 */
  __pyx_t_27 = (__pyx_v_pos1Range != Py_None);
  if (__pyx_t_27) {
    __pyx_t_25 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_25 > 1);
    __pyx_t_26 = __pyx_t_5;
  } else {
    __pyx_t_26 = __pyx_t_27;
  }
  if (__pyx_t_26) {
 252:         pos1_min = min(pos1Range)
    /* "splitBBox.pyx":252
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
 *         pos1_maxin = max(pos1Range)
 *     else:
 */
    __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos1_min = __pyx_t_28;
 253:         pos1_maxin = max(pos1Range)
    /* "splitBBox.pyx":253
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
 *     else:
 *         tmp = cdelta_pos1.min()
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_19 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_v_pos1_maxin = __pyx_t_28;
    goto __pyx_L19;
  }
  /*else*/ {
 254:     else:
 255:         tmp = cdelta_pos1.min()
    /* "splitBBox.pyx":255
 *         pos1_maxin = max(pos1Range)
 *     else:
 *         tmp = cdelta_pos1.min()             # <<<<<<<<<<<<<<
 *         pos1_min = cpos1.min() - tmp
 *         pos1_maxin = cpos1.max() + tmp
 */
    __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cdelta_pos1), __pyx_n_s__min); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_3 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_tmp = __pyx_t_28;
 256:         pos1_min = cpos1.min() - tmp
    /* "splitBBox.pyx":256
 *     else:
 *         tmp = cdelta_pos1.min()
 *         pos1_min = cpos1.min() - tmp             # <<<<<<<<<<<<<<
 *         pos1_maxin = cpos1.max() + tmp
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_19 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tmp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_19, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_min = __pyx_t_28;
 257:         pos1_maxin = cpos1.max() + tmp
    /* "splitBBox.pyx":257
 *         tmp = cdelta_pos1.min()
 *         pos1_min = cpos1.min() - tmp
 *         pos1_maxin = cpos1.max() + tmp             # <<<<<<<<<<<<<<
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __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 = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tmp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_v_pos1_maxin = __pyx_t_28;
  }
  __pyx_L19:;
 258:     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
  /* "splitBBox.pyx":258
 *         pos1_min = cpos1.min() - tmp
 *         pos1_maxin = cpos1.max() + tmp
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
 * 
 *     cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0))
 */
  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__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 = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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_t_19, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pos1_max = __pyx_t_28;
 259: 
 260:     cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0))
  /* "splitBBox.pyx":260
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)
 * 
 *     cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0))             # <<<<<<<<<<<<<<
 *     cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))
 * 
 */
  __pyx_v_dpos0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins0));
 261:     cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))
  /* "splitBBox.pyx":261
 * 
 *     cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0))
 *     cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_dpos1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((float)__pyx_v_bins1));
 262: 
 263:     with nogil:
  /* "splitBBox.pyx":263
 *     cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "splitBBox.pyx":263
 *     cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
  }
 264:         for i in range(bins0):
        /* "splitBBox.pyx":264
 * 
 *     with nogil:
 *         for i in range(bins0):             # <<<<<<<<<<<<<<
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):
 */
        __pyx_t_9 = __pyx_v_bins0;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 265:                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
          /* "splitBBox.pyx":265
 *     with nogil:
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0             # <<<<<<<<<<<<<<
 *         for i in range(bins1):
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 */
          __pyx_t_30 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_edges0.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_edges0.diminfo[0].strides) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos0));
        }
 266:         for i in range(bins1):
        /* "splitBBox.pyx":266
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):             # <<<<<<<<<<<<<<
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 * 
 */
        __pyx_t_9 = __pyx_v_bins1;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 267:                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
          /* "splitBBox.pyx":267
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1             # <<<<<<<<<<<<<<
 * 
 *         for idx in range(size):
 */
          __pyx_t_31 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_edges1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_edges1.diminfo[0].strides) = (__pyx_v_pos1_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos1));
        }
 268: 
 269:         for idx in range(size):
        /* "splitBBox.pyx":269
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 * 
 *         for idx in range(size):             # <<<<<<<<<<<<<<
 *             data = cdata[idx]
 *             min0 = cpos0_inf[idx]
 */
        __pyx_t_9 = __pyx_v_size;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_idx = __pyx_t_2;
 270:             data = cdata[idx]
          /* "splitBBox.pyx":270
 * 
 *         for idx in range(size):
 *             data = cdata[idx]             # <<<<<<<<<<<<<<
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]
 */
          __pyx_t_32 = __pyx_v_idx;
          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_cdata.diminfo[0].strides));
 271:             min0 = cpos0_inf[idx]
          /* "splitBBox.pyx":271
 *         for idx in range(size):
 *             data = cdata[idx]
 *             min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
 *             max0 = cpos0_sup[idx]
 *             min1 = cpos1_inf[idx]
 */
          __pyx_t_33 = __pyx_v_idx;
          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_cpos0_inf.diminfo[0].strides));
 272:             max0 = cpos0_sup[idx]
          /* "splitBBox.pyx":272
 *             data = cdata[idx]
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
 *             min1 = cpos1_inf[idx]
 *             max1 = cpos1_sup[idx]
 */
          __pyx_t_34 = __pyx_v_idx;
          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cpos0_sup.diminfo[0].strides));
 273:             min1 = cpos1_inf[idx]
          /* "splitBBox.pyx":273
 *             min0 = cpos0_inf[idx]
 *             max0 = cpos0_sup[idx]
 *             min1 = cpos1_inf[idx]             # <<<<<<<<<<<<<<
 *             max1 = cpos1_sup[idx]
 * 
 */
          __pyx_t_35 = __pyx_v_idx;
          __pyx_v_min1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos1_inf.diminfo[0].strides));
 274:             max1 = cpos1_sup[idx]
          /* "splitBBox.pyx":274
 *             max0 = cpos0_sup[idx]
 *             min1 = cpos1_inf[idx]
 *             max1 = cpos1_sup[idx]             # <<<<<<<<<<<<<<
 * 
 *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
 */
          __pyx_t_36 = __pyx_v_idx;
          __pyx_v_max1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_cpos1_sup.diminfo[0].strides));
 275: 
 276:             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
          /* "splitBBox.pyx":276
 *             max1 = cpos1_sup[idx]
 * 
 *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
          __pyx_t_26 = (__pyx_v_max0 < __pyx_v_pos0_min);
          if (!__pyx_t_26) {
            __pyx_t_27 = (__pyx_v_max1 < __pyx_v_pos1_min);
            if (!__pyx_t_27) {
              __pyx_t_5 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
              if (!__pyx_t_5) {
                __pyx_t_37 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
                __pyx_t_38 = __pyx_t_37;
              } else {
                __pyx_t_38 = __pyx_t_5;
              }
              __pyx_t_5 = __pyx_t_38;
            } else {
              __pyx_t_5 = __pyx_t_27;
            }
            __pyx_t_27 = __pyx_t_5;
          } else {
            __pyx_t_27 = __pyx_t_26;
          }
          if (__pyx_t_27) {
 277:                 continue
            /* "splitBBox.pyx":277
 * 
 *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if min0 < pos0_min:
 */
            goto __pyx_L27_continue;
            goto __pyx_L29;
          }
          __pyx_L29:;
 278: 
 279:             if min0 < pos0_min:
          /* "splitBBox.pyx":279
 *                 continue
 * 
 *             if min0 < pos0_min:             # <<<<<<<<<<<<<<
 *                 min0 = pos0_min
 *             if min1 < pos1_min:
 */
          __pyx_t_27 = (__pyx_v_min0 < __pyx_v_pos0_min);
          if (__pyx_t_27) {
 280:                 min0 = pos0_min
            /* "splitBBox.pyx":280
 * 
 *             if min0 < pos0_min:
 *                 min0 = pos0_min             # <<<<<<<<<<<<<<
 *             if min1 < pos1_min:
 *                 min1 = pos1_min
 */
            __pyx_v_min0 = __pyx_v_pos0_min;
            goto __pyx_L30;
          }
          __pyx_L30:;
 281:             if min1 < pos1_min:
          /* "splitBBox.pyx":281
 *             if min0 < pos0_min:
 *                 min0 = pos0_min
 *             if min1 < pos1_min:             # <<<<<<<<<<<<<<
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:
 */
          __pyx_t_27 = (__pyx_v_min1 < __pyx_v_pos1_min);
          if (__pyx_t_27) {
 282:                 min1 = pos1_min
            /* "splitBBox.pyx":282
 *                 min0 = pos0_min
 *             if min1 < pos1_min:
 *                 min1 = pos1_min             # <<<<<<<<<<<<<<
 *             if max0 > pos0_maxin:
 *                 max0 = pos0_maxin
 */
            __pyx_v_min1 = __pyx_v_pos1_min;
            goto __pyx_L31;
          }
          __pyx_L31:;
 283:             if max0 > pos0_maxin:
          /* "splitBBox.pyx":283
 *             if min1 < pos1_min:
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:             # <<<<<<<<<<<<<<
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:
 */
          __pyx_t_27 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
          if (__pyx_t_27) {
 284:                 max0 = pos0_maxin
            /* "splitBBox.pyx":284
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:
 *                 max0 = pos0_maxin             # <<<<<<<<<<<<<<
 *             if max1 > pos1_maxin:
 *                 max1 = pos1_maxin
 */
            __pyx_v_max0 = __pyx_v_pos0_maxin;
            goto __pyx_L32;
          }
          __pyx_L32:;
 285:             if max1 > pos1_maxin:
          /* "splitBBox.pyx":285
 *             if max0 > pos0_maxin:
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:             # <<<<<<<<<<<<<<
 *                 max1 = pos1_maxin
 * 
 */
          __pyx_t_27 = (__pyx_v_max1 > __pyx_v_pos1_maxin);
          if (__pyx_t_27) {
 286:                 max1 = pos1_maxin
            /* "splitBBox.pyx":286
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:
 *                 max1 = pos1_maxin             # <<<<<<<<<<<<<<
 * 
 * 
 */
            __pyx_v_max1 = __pyx_v_pos1_maxin;
            goto __pyx_L33;
          }
          __pyx_L33:;
 287: 
 288: 
 289:             fbin0_min = getBinNr(min0, pos0_min, dpos0)
          /* "splitBBox.pyx":289
 * 
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)             # <<<<<<<<<<<<<<
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 */
          __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos0);
 290:             fbin0_max = getBinNr(max0, pos0_min, dpos0)
          /* "splitBBox.pyx":290
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)             # <<<<<<<<<<<<<<
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 */
          __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos0);
 291:             fbin1_min = getBinNr(min1, pos1_min, dpos1)
          /* "splitBBox.pyx":291
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)             # <<<<<<<<<<<<<<
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 * 
 */
          __pyx_v_fbin1_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_dpos1);
 292:             fbin1_max = getBinNr(max1, pos1_min, dpos1)
          /* "splitBBox.pyx":292
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)             # <<<<<<<<<<<<<<
 * 
 *             bin0_min = < long > floor(fbin0_min)
 */
          __pyx_v_fbin1_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_dpos1);
 293: 
 294:             bin0_min = < long > floor(fbin0_min)
          /* "splitBBox.pyx":294
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 * 
 *             bin0_min = < long > floor(fbin0_min)             # <<<<<<<<<<<<<<
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)
 */
          __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min));
 295:             bin0_max = < long > floor(fbin0_max)
          /* "splitBBox.pyx":295
 * 
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)             # <<<<<<<<<<<<<<
 *             bin1_min = < long > floor(fbin1_min)
 *             bin1_max = < long > floor(fbin1_max)
 */
          __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max));
 296:             bin1_min = < long > floor(fbin1_min)
          /* "splitBBox.pyx":296
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)             # <<<<<<<<<<<<<<
 *             bin1_max = < long > floor(fbin1_max)
 * 
 */
          __pyx_v_bin1_min = ((long)floor(__pyx_v_fbin1_min));
 297:             bin1_max = < long > floor(fbin1_max)
          /* "splitBBox.pyx":297
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)
 *             bin1_max = < long > floor(fbin1_max)             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_v_bin1_max = ((long)floor(__pyx_v_fbin1_max));
 298: 
 299: 
 300:             if bin0_min == bin0_max:
          /* "splitBBox.pyx":300
 * 
 * 
 *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
 *                 if bin1_min == bin1_max:
 *                     #All pixel is within a single bin
 */
          __pyx_t_27 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
          if (__pyx_t_27) {
 301:                 if bin1_min == bin1_max:
            /* "splitBBox.pyx":301
 * 
 *             if bin0_min == bin0_max:
 *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0
 */
            __pyx_t_27 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
            if (__pyx_t_27) {
 302:                     #All pixel is within a single bin
 303:                     outCount[bin0_min, bin1_min] += 1.0
              /* "splitBBox.pyx":303
 *                 if bin1_min == bin1_max:
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data
 *                 else:
 */
              __pyx_t_39 = __pyx_v_bin0_min;
              __pyx_t_40 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_outCount.diminfo[1].strides) += 1.0;
 304:                     outData[bin0_min, bin1_min] += data
              /* "splitBBox.pyx":304
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0
 *                     outData[bin0_min, bin1_min] += data             # <<<<<<<<<<<<<<
 *                 else:
 *                     #spread on more than 2 bins
 */
              __pyx_t_41 = __pyx_v_bin0_min;
              __pyx_t_42 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_outData.diminfo[1].strides) += __pyx_v_data;
              goto __pyx_L35;
            }
            /*else*/ {
 305:                 else:
 306:                     #spread on more than 2 bins
 307:                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
              /* "splitBBox.pyx":307
 *                 else:
 *                     #spread on more than 2 bins
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
 */
              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 308:                     deltaU = fbin1_max - (< double > bin1_max)
              /* "splitBBox.pyx":308
 *                     #spread on more than 2 bins
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)             # <<<<<<<<<<<<<<
 *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
 * 
 */
              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max));
 309:                     deltaA = 1.0 / (fbin1_max - fbin1_min)
              /* "splitBBox.pyx":309
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaD
 */
              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
 310: 
 311:                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaD
              /* "splitBBox.pyx":311
 *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
 * 
 */
              __pyx_t_43 = __pyx_v_bin0_min;
              __pyx_t_44 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaD);
 312:                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
              /* "splitBBox.pyx":312
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaD
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaU
 */
              __pyx_t_45 = __pyx_v_bin0_min;
              __pyx_t_46 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
 313: 
 314:                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaU
              /* "splitBBox.pyx":314
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 */
              __pyx_t_47 = __pyx_v_bin0_min;
              __pyx_t_48 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaU);
 315:                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
              /* "splitBBox.pyx":315
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaU
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU             # <<<<<<<<<<<<<<
 *                     for j in range(bin1_min + 1, bin1_max):
 *                         outCount[bin0_min, j] += < double > deltaA
 */
              __pyx_t_49 = __pyx_v_bin0_min;
              __pyx_t_50 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
 316:                     for j in range(bin1_min + 1, bin1_max):
              /* "splitBBox.pyx":316
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaU
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                         outCount[bin0_min, j] += < double > deltaA
 *                         outData[bin0_min, j] += data * deltaA
 */
              __pyx_t_51 = __pyx_v_bin1_max;
              for (__pyx_t_52 = (__pyx_v_bin1_min + 1); __pyx_t_52 < __pyx_t_51; __pyx_t_52+=1) {
                __pyx_v_j = __pyx_t_52;
 317:                         outCount[bin0_min, j] += < double > deltaA
                /* "splitBBox.pyx":317
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 *                         outCount[bin0_min, j] += < double > deltaA             # <<<<<<<<<<<<<<
 *                         outData[bin0_min, j] += data * deltaA
 * 
 */
                __pyx_t_53 = __pyx_v_bin0_min;
                __pyx_t_54 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_54, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA);
 318:                         outData[bin0_min, j] += data * deltaA
                /* "splitBBox.pyx":318
 *                     for j in range(bin1_min + 1, bin1_max):
 *                         outCount[bin0_min, j] += < double > deltaA
 *                         outData[bin0_min, j] += data * deltaA             # <<<<<<<<<<<<<<
 * 
 *             else: #spread on more than 2 bins in dim 0
 */
                __pyx_t_55 = __pyx_v_bin0_min;
                __pyx_t_56 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
              }
            }
            __pyx_L35:;
            goto __pyx_L34;
          }
          /*else*/ {
 319: 
 320:             else: #spread on more than 2 bins in dim 0
 321:                 if bin1_min == bin1_max:
            /* "splitBBox.pyx":321
 * 
 *             else: #spread on more than 2 bins in dim 0
 *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
 *                     #All pixel fall on 1 bins in dim 1
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
 */
            __pyx_t_27 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
            if (__pyx_t_27) {
 322:                     #All pixel fall on 1 bins in dim 1
 323:                     deltaA = 1.0 / (fbin0_max - fbin0_min)
              /* "splitBBox.pyx":323
 *                 if bin1_min == bin1_max:
 *                     #All pixel fall on 1 bins in dim 1
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
 */
              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
 324:                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
              /* "splitBBox.pyx":324
 *                     #All pixel fall on 1 bins in dim 1
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
 */
              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 325:                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
              /* "splitBBox.pyx":325
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
 *                     deltaR = fbin0_max - (< float > bin0_max)
 */
              __pyx_t_51 = __pyx_v_bin0_min;
              __pyx_t_52 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL);
 326:                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
              /* "splitBBox.pyx":326
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL             # <<<<<<<<<<<<<<
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
 */
              __pyx_t_57 = __pyx_v_bin0_min;
              __pyx_t_58 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL);
 327:                     deltaR = fbin0_max - (< float > bin0_max)
              /* "splitBBox.pyx":327
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
 *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
 */
              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 328:                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
              /* "splitBBox.pyx":328
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
 *                     for i in range(bin0_min + 1, bin0_max):
 */
              __pyx_t_59 = __pyx_v_bin0_max;
              __pyx_t_60 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR);
 329:                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
              /* "splitBBox.pyx":329
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA
 */
              __pyx_t_61 = __pyx_v_bin0_max;
              __pyx_t_62 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR);
 330:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitBBox.pyx":330
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_min] += < double > deltaA
 *                             outData[i, bin1_min] += < double > data * deltaA
 */
              __pyx_t_63 = __pyx_v_bin0_max;
              for (__pyx_t_64 = (__pyx_v_bin0_min + 1); __pyx_t_64 < __pyx_t_63; __pyx_t_64+=1) {
                __pyx_v_i = __pyx_t_64;
 331:                             outCount[i, bin1_min] += < double > deltaA
                /* "splitBBox.pyx":331
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_min] += < double > data * deltaA
 *                 else:
 */
                __pyx_t_65 = __pyx_v_i;
                __pyx_t_66 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA);
 332:                             outData[i, bin1_min] += < double > data * deltaA
                /* "splitBBox.pyx":332
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA
 *                             outData[i, bin1_min] += < double > data * deltaA             # <<<<<<<<<<<<<<
 *                 else:
 *                     #spread on n pix in dim0 and m pixel in dim1:
 */
                __pyx_t_67 = __pyx_v_i;
                __pyx_t_68 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_outData.diminfo[1].strides) += (((double)__pyx_v_data) * __pyx_v_deltaA);
              }
              goto __pyx_L38;
            }
            /*else*/ {
 333:                 else:
 334:                     #spread on n pix in dim0 and m pixel in dim1:
 335:                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
              /* "splitBBox.pyx":335
 *                 else:
 *                     #spread on n pix in dim0 and m pixel in dim1:
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 */
              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 336:                     deltaR = fbin0_max - (< float > bin0_max)
              /* "splitBBox.pyx":336
 *                     #spread on n pix in dim0 and m pixel in dim1:
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
 *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< float > bin1_max)
 */
              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 337:                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
              /* "splitBBox.pyx":337
 *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
 *                     deltaU = fbin1_max - (< float > bin1_max)
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min)
 */
              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 338:                     deltaU = fbin1_max - (< float > bin1_max)
              /* "splitBBox.pyx":338
 *                     deltaR = fbin0_max - (< float > bin0_max)
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< float > bin1_max)             # <<<<<<<<<<<<<<
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min)
 * 
 */
              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max));
 339:                     deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min)
              /* "splitBBox.pyx":339
 *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< float > bin1_max)
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD
 */
              __pyx_v_deltaA = ((1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min)) / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
 340: 
 341:                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD
              /* "splitBBox.pyx":341
 *                     deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min)
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD
 * 
 */
              __pyx_t_63 = __pyx_v_bin0_min;
              __pyx_t_64 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
 342:                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD
              /* "splitBBox.pyx":342
 * 
 *                     outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU
 */
              __pyx_t_69 = __pyx_v_bin0_min;
              __pyx_t_70 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
 343: 
 344:                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU
              /* "splitBBox.pyx":344
 *                     outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU
 * 
 */
              __pyx_t_71 = __pyx_v_bin0_min;
              __pyx_t_72 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
 345:                     outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU
              /* "splitBBox.pyx":345
 * 
 *                     outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU
 *                     outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD
 */
              __pyx_t_73 = __pyx_v_bin0_min;
              __pyx_t_74 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_74, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
 346: 
 347:                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD
              /* "splitBBox.pyx":347
 *                     outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU
 * 
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD
 * 
 */
              __pyx_t_75 = __pyx_v_bin0_max;
              __pyx_t_76 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
 348:                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD
              /* "splitBBox.pyx":348
 * 
 *                     outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU
 */
              __pyx_t_77 = __pyx_v_bin0_max;
              __pyx_t_78 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_78, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
 349: 
 350:                     outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU
              /* "splitBBox.pyx":350
 *                     outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD
 * 
 *                     outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):
 */
              __pyx_t_79 = __pyx_v_bin0_max;
              __pyx_t_80 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
 351:                     outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU
              /* "splitBBox.pyx":351
 * 
 *                     outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU
 *                     outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA * deltaD
 */
              __pyx_t_81 = __pyx_v_bin0_max;
              __pyx_t_82 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_81, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_82, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
 352:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitBBox.pyx":352
 *                     outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU
 *                     outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_min] += < double > deltaA * deltaD
 *                             outData[i, bin1_min] += < double > data * deltaA * deltaD
 */
              __pyx_t_83 = __pyx_v_bin0_max;
              for (__pyx_t_84 = (__pyx_v_bin0_min + 1); __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) {
                __pyx_v_i = __pyx_t_84;
 353:                             outCount[i, bin1_min] += < double > deltaA * deltaD
                /* "splitBBox.pyx":353
 *                     outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA * deltaD             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_min] += < double > data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):
 */
                __pyx_t_85 = __pyx_v_i;
                __pyx_t_86 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaD);
 354:                             outData[i, bin1_min] += < double > data * deltaA * deltaD
                /* "splitBBox.pyx":354
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += < double > deltaA * deltaD
 *                             outData[i, bin1_min] += < double > data * deltaA * deltaD             # <<<<<<<<<<<<<<
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += < double > deltaA
 */
                __pyx_t_87 = __pyx_v_i;
                __pyx_t_88 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaD);
 355:                             for j in range(bin1_min + 1, bin1_max):
                /* "splitBBox.pyx":355
 *                             outCount[i, bin1_min] += < double > deltaA * deltaD
 *                             outData[i, bin1_min] += < double > data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                                 outCount[i, j] += < double > deltaA
 *                                 outData[i, j] += < double > data * deltaA
 */
                __pyx_t_89 = __pyx_v_bin1_max;
                for (__pyx_t_90 = (__pyx_v_bin1_min + 1); __pyx_t_90 < __pyx_t_89; __pyx_t_90+=1) {
                  __pyx_v_j = __pyx_t_90;
 356:                                 outCount[i, j] += < double > deltaA
                  /* "splitBBox.pyx":356
 *                             outData[i, bin1_min] += < double > data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += < double > deltaA             # <<<<<<<<<<<<<<
 *                                 outData[i, j] += < double > data * deltaA
 *                             outCount[i, bin1_max] += < double > deltaA * deltaU
 */
                  __pyx_t_91 = __pyx_v_i;
                  __pyx_t_92 = __pyx_v_j;
                  *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_92, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA);
 357:                                 outData[i, j] += < double > data * deltaA
                  /* "splitBBox.pyx":357
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += < double > deltaA
 *                                 outData[i, j] += < double > data * deltaA             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_max] += < double > deltaA * deltaU
 *                             outData[i, bin1_max] += < double > data * deltaA * deltaU
 */
                  __pyx_t_93 = __pyx_v_i;
                  __pyx_t_94 = __pyx_v_j;
                  *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_94, __pyx_pybuffernd_outData.diminfo[1].strides) += (((double)__pyx_v_data) * __pyx_v_deltaA);
                }
 358:                             outCount[i, bin1_max] += < double > deltaA * deltaU
                /* "splitBBox.pyx":358
 *                                 outCount[i, j] += < double > deltaA
 *                                 outData[i, j] += < double > data * deltaA
 *                             outCount[i, bin1_max] += < double > deltaA * deltaU             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_max] += < double > data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 */
                __pyx_t_89 = __pyx_v_i;
                __pyx_t_90 = __pyx_v_bin1_max;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaU);
 359:                             outData[i, bin1_max] += < double > data * deltaA * deltaU
                /* "splitBBox.pyx":359
 *                                 outData[i, j] += < double > data * deltaA
 *                             outCount[i, bin1_max] += < double > deltaA * deltaU
 *                             outData[i, bin1_max] += < double > data * deltaA * deltaU             # <<<<<<<<<<<<<<
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += < double > deltaA * deltaL
 */
                __pyx_t_95 = __pyx_v_i;
                __pyx_t_96 = __pyx_v_bin1_max;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaU);
              }
 360:                     for j in range(bin1_min + 1, bin1_max):
              /* "splitBBox.pyx":360
 *                             outCount[i, bin1_max] += < double > deltaA * deltaU
 *                             outData[i, bin1_max] += < double > data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                             outCount[bin0_min, j] += < double > deltaA * deltaL
 *                             outData[bin0_min, j] += < double > data * deltaA * deltaL
 */
              __pyx_t_83 = __pyx_v_bin1_max;
              for (__pyx_t_84 = (__pyx_v_bin1_min + 1); __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) {
                __pyx_v_j = __pyx_t_84;
 361:                             outCount[bin0_min, j] += < double > deltaA * deltaL
                /* "splitBBox.pyx":361
 *                             outData[i, bin1_max] += < double > data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += < double > deltaA * deltaL             # <<<<<<<<<<<<<<
 *                             outData[bin0_min, j] += < double > data * deltaA * deltaL
 * 
 */
                __pyx_t_97 = __pyx_v_bin0_min;
                __pyx_t_98 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL);
 362:                             outData[bin0_min, j] += < double > data * deltaA * deltaL
                /* "splitBBox.pyx":362
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += < double > deltaA * deltaL
 *                             outData[bin0_min, j] += < double > data * deltaA * deltaL             # <<<<<<<<<<<<<<
 * 
 *                             outCount[bin0_max, j] += < double > deltaA * deltaR
 */
                __pyx_t_99 = __pyx_v_bin0_min;
                __pyx_t_100 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_99, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_100, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL);
 363: 
 364:                             outCount[bin0_max, j] += < double > deltaA * deltaR
                /* "splitBBox.pyx":364
 *                             outData[bin0_min, j] += < double > data * deltaA * deltaL
 * 
 *                             outCount[bin0_max, j] += < double > deltaA * deltaR             # <<<<<<<<<<<<<<
 *                             outData[bin0_max, j] += < double > data * deltaA * deltaR
 * 
 */
                __pyx_t_101 = __pyx_v_bin0_max;
                __pyx_t_102 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_101, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_102, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR);
 365:                             outData[bin0_max, j] += < double > data * deltaA * deltaR
                /* "splitBBox.pyx":365
 * 
 *                             outCount[bin0_max, j] += < double > deltaA * deltaR
 *                             outData[bin0_max, j] += < double > data * deltaA * deltaR             # <<<<<<<<<<<<<<
 * 
 *         for i in range(bins0):
 */
                __pyx_t_103 = __pyx_v_bin0_max;
                __pyx_t_104 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_103, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_104, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR);
              }
            }
            __pyx_L38:;
          }
          __pyx_L34:;
          __pyx_L27_continue:;
        }
 366: 
 367:         for i in range(bins0):
        /* "splitBBox.pyx":367
 *                             outData[bin0_max, j] += < double > data * deltaA * deltaR
 * 
 *         for i in range(bins0):             # <<<<<<<<<<<<<<
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:
 */
        __pyx_t_9 = __pyx_v_bins0;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 368:             for j in range(bins1):
          /* "splitBBox.pyx":368
 * 
 *         for i in range(bins0):
 *             for j in range(bins1):             # <<<<<<<<<<<<<<
 *                 if outCount[i, j] > epsilon:
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 */
          __pyx_t_83 = __pyx_v_bins1;
          for (__pyx_t_84 = 0; __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) {
            __pyx_v_j = __pyx_t_84;
 369:                 if outCount[i, j] > epsilon:
            /* "splitBBox.pyx":369
 *         for i in range(bins0):
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:             # <<<<<<<<<<<<<<
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 *                 else:
 */
            __pyx_t_105 = __pyx_v_i;
            __pyx_t_106 = __pyx_v_j;
            __pyx_t_27 = ((*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_105, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_106, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon);
            if (__pyx_t_27) {
 370:                     outMerge[i, j] = outData[i, j] / outCount[i, j]
              /* "splitBBox.pyx":370
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]             # <<<<<<<<<<<<<<
 *                 else:
 *                     outMerge[i, j] = dummy
 */
              __pyx_t_107 = __pyx_v_i;
              __pyx_t_108 = __pyx_v_j;
              __pyx_t_109 = __pyx_v_i;
              __pyx_t_110 = __pyx_v_j;
              __pyx_t_111 = __pyx_v_i;
              __pyx_t_112 = __pyx_v_j;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_111, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_112, __pyx_pybuffernd_outMerge.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_107, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_108, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_outCount.diminfo[1].strides)));
              goto __pyx_L51;
            }
            /*else*/ {
 371:                 else:
 372:                     outMerge[i, j] = dummy
              /* "splitBBox.pyx":372
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 *                 else:
 *                     outMerge[i, j] = dummy             # <<<<<<<<<<<<<<
 *     return outMerge.T, edges0, edges1, outData.T, outCount.T
 * 
 */
              __pyx_t_113 = __pyx_v_i;
              __pyx_t_114 = __pyx_v_j;
              *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_113, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_outMerge.diminfo[1].strides) = __pyx_v_dummy;
            }
            __pyx_L51:;
          }
        }
      }
 373:     return outMerge.T, edges0, edges1, outData.T, outCount.T
  /* "splitBBox.pyx":373
 *                 else:
 *                     outMerge[i, j] = dummy
 *     return outMerge.T, edges0, edges1, outData.T, outCount.T             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __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_INCREF(((PyObject *)__pyx_v_edges0));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0));
  __Pyx_INCREF(((PyObject *)__pyx_v_edges1));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1));
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_19);
  __Pyx_GIVEREF(__pyx_t_19);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_19 = 0;
  __pyx_r = ((PyObject *)__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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_19);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdelta_pos0);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_inf);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_sup);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdelta_pos1);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_inf);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_sup);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges0);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 374: 

pyfai-0.3.5/src/bilinear.html0000644001611600065110000020723011703641246015253 0ustar  kieffersoft







        

Generated by Cython 0.15.1+ on Wed Dec 21 21:48:02 2011

Raw output: bilinear.c

 1: # -*- coding: utf8 -*-
  /* "bilinear.pyx":1
 * # -*- coding: utf8 -*-             # <<<<<<<<<<<<<<
 * #
 * #    Project: Azimuthal integration
 */
  __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: #
 3: #    Project: Azimuthal integration
 4: #             https://forge.epn-campus.eu/projects/azimuthal
 5: #
 6: #    File: "$Id$"
 7: #
 8: #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
 9: #
 10: #    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
 11: #
 12: #    This program is free software: you can redistribute it and/or modify
 13: #    it under the terms of the GNU General Public License as published by
 14: #    the Free Software Foundation, either version 3 of the License, or
 15: #    (at your option) any later version.
 16: #
 17: #    This program is distributed in the hope that it will be useful,
 18: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 19: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20: #    GNU General Public License for more details.
 21: #
 22: #    You should have received a copy of the GNU General Public License
 23: #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 24: #
 25: 
 26: __author__ = "Jerome Kieffer"
  /* "bilinear.pyx":26
 * #
 * 
 * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
 * __license__ = "GPLv3"
 * __date__ = "21/12/2011"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 27: __license__ = "GPLv3"
  /* "bilinear.pyx":27
 * 
 * __author__ = "Jerome Kieffer"
 * __license__ = "GPLv3"             # <<<<<<<<<<<<<<
 * __date__ = "21/12/2011"
 * __copyright__ = "2011, ESRF"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_n_s__GPLv3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 28: __date__ = "21/12/2011"
  /* "bilinear.pyx":28
 * __author__ = "Jerome Kieffer"
 * __license__ = "GPLv3"
 * __date__ = "21/12/2011"             # <<<<<<<<<<<<<<
 * __copyright__ = "2011, ESRF"
 * __contact__ = "jerome.kieffer@esrf.fr"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 29: __copyright__ = "2011, ESRF"
  /* "bilinear.pyx":29
 * __license__ = "GPLv3"
 * __date__ = "21/12/2011"
 * __copyright__ = "2011, ESRF"             # <<<<<<<<<<<<<<
 * __contact__ = "jerome.kieffer@esrf.fr"
 * 
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 30: __contact__ = "jerome.kieffer@esrf.fr"
  /* "bilinear.pyx":30
 * __date__ = "21/12/2011"
 * __copyright__ = "2011, ESRF"
 * __contact__ = "jerome.kieffer@esrf.fr"             # <<<<<<<<<<<<<<
 * 
 * import cython
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 31: 
 32: import cython
 33: cimport numpy
 34: import numpy
  /* "bilinear.pyx":34
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * ctypedef numpy.float32_t DTYPE_float32_t
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); 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);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __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;
 35: ctypedef numpy.float32_t DTYPE_float32_t
 36: 
 37: cdef extern from "math.h":
 38:     float floor(float) nogil
 39:     float ceil(float) nogil
 40: cdef extern from "stdlib.h":
 41:     void free(void * ptr)nogil
 42:     void * calloc(size_t nmemb, size_t size)nogil
 43:     void * malloc(size_t size)nogil
 44:     void * memcpy(void * dst, void * src, long n)
 45: cdef extern from "numpy/arrayobject.h":
 46:     ctypedef int intp
 47:     ctypedef extern class numpy.ndarray [object PyArrayObject]:
 48:         cdef char * data
 49:         cdef int nd
 50:         cdef intp * dimensions
 51:         cdef intp * strides
 52:         cdef int flags
 53: 
 54: @cython.boundscheck(False)
 55: cdef class bilinear:
 56:     """Bilinear interpolator for finding max"""
 57: 
 58:     cdef float * data
 59:     cdef float max, min
 60:     cdef long d0_max, d1_max, r
 61: 
 62:     def __dealloc__(self):
/* "bilinear.pyx":62
 *     cdef long d0_max, d1_max, r
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         free(self.data)
 * 
 */

static void __pyx_pf_8bilinear_8bilinear___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_8bilinear_8bilinear___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");
 63:         free(self.data)
  /* "bilinear.pyx":63
 * 
 *     def __dealloc__(self):
 *         free(self.data)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, numpy.ndarray data not None):
 */
  free(((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data);

  __Pyx_RefNannyFinishContext();
}
 64: 
 65:     def __init__(self, numpy.ndarray data not None):
/* "bilinear.pyx":65
 *         free(self.data)
 * 
 *     def __init__(self, numpy.ndarray data not None):             # <<<<<<<<<<<<<<
 *         assert data.ndim == 2
 *         self.d0_max = data.shape[0] - 1
 */

static int __pyx_pf_8bilinear_8bilinear_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8bilinear_8bilinear_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_data2 = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_data2;
  __Pyx_Buffer __pyx_pybuffer_data2;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__");
  {
    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:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
        if (likely(values[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, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __pyx_v_data = ((PyArrayObject *)values[0]);
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_data = ((PyArrayObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("bilinear.bilinear.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_pybuffer_data2.pybuffer.buf = NULL;
  __pyx_pybuffer_data2.refcount = 0;
  __pyx_pybuffernd_data2.data = NULL;
  __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 66:         assert data.ndim == 2
  /* "bilinear.pyx":66
 * 
 *     def __init__(self, numpy.ndarray data not None):
 *         assert data.ndim == 2             # <<<<<<<<<<<<<<
 *         self.d0_max = data.shape[0] - 1
 *         self.d1_max = data.shape[1] - 1
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_data->nd == 2))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 67:         self.d0_max = data.shape[0] - 1
  /* "bilinear.pyx":67
 *     def __init__(self, numpy.ndarray data not None):
 *         assert data.ndim == 2
 *         self.d0_max = data.shape[0] - 1             # <<<<<<<<<<<<<<
 *         self.d1_max = data.shape[1] - 1
 *         self.r = data.shape[1]
 */
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max = ((__pyx_v_data->dimensions[0]) - 1);
 68:         self.d1_max = data.shape[1] - 1
  /* "bilinear.pyx":68
 *         assert data.ndim == 2
 *         self.d0_max = data.shape[0] - 1
 *         self.d1_max = data.shape[1] - 1             # <<<<<<<<<<<<<<
 *         self.r = data.shape[1]
 *         self.max = data.max()
 */
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max = ((__pyx_v_data->dimensions[1]) - 1);
 69:         self.r = data.shape[1]
  /* "bilinear.pyx":69
 *         self.d0_max = data.shape[0] - 1
 *         self.d1_max = data.shape[1] - 1
 *         self.r = data.shape[1]             # <<<<<<<<<<<<<<
 *         self.max = data.max()
 *         self.min = data.min()
 */
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r = (__pyx_v_data->dimensions[1]);
 70:         self.max = data.max()
  /* "bilinear.pyx":70
 *         self.d1_max = data.shape[1] - 1
 *         self.r = data.shape[1]
 *         self.max = data.max()             # <<<<<<<<<<<<<<
 *         self.min = data.min()
 *         self.data = < float *> malloc(data.size * sizeof(float))
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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 = 70; __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_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->max = __pyx_t_3;
 71:         self.min = data.min()
  /* "bilinear.pyx":71
 *         self.r = data.shape[1]
 *         self.max = data.max()
 *         self.min = data.min()             # <<<<<<<<<<<<<<
 *         self.data = < float *> malloc(data.size * sizeof(float))
 *         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min = __pyx_t_3;
 72:         self.data = < float *> malloc(data.size * sizeof(float))
  /* "bilinear.pyx":72
 *         self.max = data.max()
 *         self.min = data.min()
 *         self.data = < float *> malloc(data.size * sizeof(float))             # <<<<<<<<<<<<<<
 *         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))
 *         memcpy(self.data, data2.data, data.size * sizeof(float))
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data = ((float *)malloc(__pyx_t_5));
 73:         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))
  /* "bilinear.pyx":73
 *         self.min = data.min()
 *         self.data = < float *> malloc(data.size * sizeof(float))
 *         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))             # <<<<<<<<<<<<<<
 *         memcpy(self.data, data2.data, data.size * sizeof(float))
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8bilinear_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_data2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_data2.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data2.diminfo[1].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data2.diminfo[1].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_data2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "bilinear.pyx":73
 *         self.min = data.min()
 *         self.data = < float *> malloc(data.size * sizeof(float))
 *         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))             # <<<<<<<<<<<<<<
 *         memcpy(self.data, data2.data, data.size * sizeof(float))
 * 
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 74:         memcpy(self.data, data2.data, data.size * sizeof(float))
  /* "bilinear.pyx":74
 *         self.data = < float *> malloc(data.size * sizeof(float))
 *         cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32"))
 *         memcpy(self.data, data2.data, data.size * sizeof(float))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  memcpy(((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data, __pyx_v_data2->data, __pyx_t_7);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("bilinear.bilinear.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 75: 
 76: 
 77:     def f_cy(self, x):
/* "bilinear.pyx":77
 * 
 * 
 *     def f_cy(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates
 */

static PyObject *__pyx_pf_8bilinear_8bilinear_2f_cy(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_8bilinear_8bilinear_2f_cy[] = "\n        Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates\n        @param x: 2-tuple of float \n        @return: Interpolated signal from the image (negative for minimizer)\n\n        ";
static PyObject *__pyx_pf_8bilinear_8bilinear_2f_cy(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  float __pyx_v_d0;
  float __pyx_v_d1;
  int __pyx_v_i0;
  int __pyx_v_i1;
  int __pyx_v_j0;
  int __pyx_v_j1;
  float __pyx_v_x0;
  float __pyx_v_x1;
  float __pyx_v_y0;
  float __pyx_v_y1;
  float __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("f_cy");
 78:         """
 79:         Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates
 80:         @param x: 2-tuple of float
 81:         @return: Interpolated signal from the image (negative for minimizer)
 82: 
 83:         """
 84:         cdef float d0 = x[0]
  /* "bilinear.pyx":84
 * 
 *         """
 *         cdef float d0 = x[0]             # <<<<<<<<<<<<<<
 *         cdef float d1 = x[1]
 *         cdef int i0, i1, j0, j1
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d0 = __pyx_t_2;
 85:         cdef float d1 = x[1]
  /* "bilinear.pyx":85
 *         """
 *         cdef float d0 = x[0]
 *         cdef float d1 = x[1]             # <<<<<<<<<<<<<<
 *         cdef int i0, i1, j0, j1
 *         cdef float x0, x1, y0, y1, res
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d1 = __pyx_t_2;
 86:         cdef int i0, i1, j0, j1
 87:         cdef float x0, x1, y0, y1, res
 88:         x0 = floor(d0)
  /* "bilinear.pyx":88
 *         cdef int i0, i1, j0, j1
 *         cdef float x0, x1, y0, y1, res
 *         x0 = floor(d0)             # <<<<<<<<<<<<<<
 *         x1 = ceil(d0)
 *         y0 = floor(d1)
 */
  __pyx_v_x0 = floor(__pyx_v_d0);
 89:         x1 = ceil(d0)
  /* "bilinear.pyx":89
 *         cdef float x0, x1, y0, y1, res
 *         x0 = floor(d0)
 *         x1 = ceil(d0)             # <<<<<<<<<<<<<<
 *         y0 = floor(d1)
 *         y1 = ceil(d1)
 */
  __pyx_v_x1 = ceil(__pyx_v_d0);
 90:         y0 = floor(d1)
  /* "bilinear.pyx":90
 *         x0 = floor(d0)
 *         x1 = ceil(d0)
 *         y0 = floor(d1)             # <<<<<<<<<<<<<<
 *         y1 = ceil(d1)
 *         i0 = < int > x0
 */
  __pyx_v_y0 = floor(__pyx_v_d1);
 91:         y1 = ceil(d1)
  /* "bilinear.pyx":91
 *         x1 = ceil(d0)
 *         y0 = floor(d1)
 *         y1 = ceil(d1)             # <<<<<<<<<<<<<<
 *         i0 = < int > x0
 *         i1 = < int > x1
 */
  __pyx_v_y1 = ceil(__pyx_v_d1);
 92:         i0 = < int > x0
  /* "bilinear.pyx":92
 *         y0 = floor(d1)
 *         y1 = ceil(d1)
 *         i0 = < int > x0             # <<<<<<<<<<<<<<
 *         i1 = < int > x1
 *         j0 = < int > y0
 */
  __pyx_v_i0 = ((int)__pyx_v_x0);
 93:         i1 = < int > x1
  /* "bilinear.pyx":93
 *         y1 = ceil(d1)
 *         i0 = < int > x0
 *         i1 = < int > x1             # <<<<<<<<<<<<<<
 *         j0 = < int > y0
 *         j1 = < int > y1
 */
  __pyx_v_i1 = ((int)__pyx_v_x1);
 94:         j0 = < int > y0
  /* "bilinear.pyx":94
 *         i0 = < int > x0
 *         i1 = < int > x1
 *         j0 = < int > y0             # <<<<<<<<<<<<<<
 *         j1 = < int > y1
 *         if d0 < 0:
 */
  __pyx_v_j0 = ((int)__pyx_v_y0);
 95:         j1 = < int > y1
  /* "bilinear.pyx":95
 *         i1 = < int > x1
 *         j0 = < int > y0
 *         j1 = < int > y1             # <<<<<<<<<<<<<<
 *         if d0 < 0:
 *             res = self.min + d0
 */
  __pyx_v_j1 = ((int)__pyx_v_y1);
 96:         if d0 < 0:
  /* "bilinear.pyx":96
 *         j0 = < int > y0
 *         j1 = < int > y1
 *         if d0 < 0:             # <<<<<<<<<<<<<<
 *             res = self.min + d0
 *         elif d1 < 0:
 */
  __pyx_t_3 = (__pyx_v_d0 < 0.0);
  if (__pyx_t_3) {
 97:             res = self.min + d0
    /* "bilinear.pyx":97
 *         j1 = < int > y1
 *         if d0 < 0:
 *             res = self.min + d0             # <<<<<<<<<<<<<<
 *         elif d1 < 0:
 *             res = self.min + d1
 */
    __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min + __pyx_v_d0);
    goto __pyx_L5;
  }
 98:         elif d1 < 0:
  /* "bilinear.pyx":98
 *         if d0 < 0:
 *             res = self.min + d0
 *         elif d1 < 0:             # <<<<<<<<<<<<<<
 *             res = self.min + d1
 *         elif d0 > self.d0_max:
 */
  __pyx_t_3 = (__pyx_v_d1 < 0.0);
  if (__pyx_t_3) {
 99:             res = self.min + d1
    /* "bilinear.pyx":99
 *             res = self.min + d0
 *         elif d1 < 0:
 *             res = self.min + d1             # <<<<<<<<<<<<<<
 *         elif d0 > self.d0_max:
 *             res = self.min - d0 + self.d0_max
 */
    __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min + __pyx_v_d1);
    goto __pyx_L5;
  }
 100:         elif d0 > self.d0_max:
  /* "bilinear.pyx":100
 *         elif d1 < 0:
 *             res = self.min + d1
 *         elif d0 > self.d0_max:             # <<<<<<<<<<<<<<
 *             res = self.min - d0 + self.d0_max
 *         elif d1 > self.d1_max:
 */
  __pyx_t_3 = (__pyx_v_d0 > ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max);
  if (__pyx_t_3) {
 101:             res = self.min - d0 + self.d0_max
    /* "bilinear.pyx":101
 *             res = self.min + d1
 *         elif d0 > self.d0_max:
 *             res = self.min - d0 + self.d0_max             # <<<<<<<<<<<<<<
 *         elif d1 > self.d1_max:
 *             res = self.min - d1 + self.d1_max
 */
    __pyx_v_res = ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min - __pyx_v_d0) + ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d0_max);
    goto __pyx_L5;
  }
 102:         elif d1 > self.d1_max:
  /* "bilinear.pyx":102
 *         elif d0 > self.d0_max:
 *             res = self.min - d0 + self.d0_max
 *         elif d1 > self.d1_max:             # <<<<<<<<<<<<<<
 *             res = self.min - d1 + self.d1_max
 *         elif (i0 == i1) and (j0 == j1):
 */
  __pyx_t_3 = (__pyx_v_d1 > ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max);
  if (__pyx_t_3) {
 103:             res = self.min - d1 + self.d1_max
    /* "bilinear.pyx":103
 *             res = self.min - d0 + self.d0_max
 *         elif d1 > self.d1_max:
 *             res = self.min - d1 + self.d1_max             # <<<<<<<<<<<<<<
 *         elif (i0 == i1) and (j0 == j1):
 *             res = self.data[i0 * self.r + j0]
 */
    __pyx_v_res = ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->min - __pyx_v_d1) + ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->d1_max);
    goto __pyx_L5;
  }
 104:         elif (i0 == i1) and (j0 == j1):
  /* "bilinear.pyx":104
 *         elif d1 > self.d1_max:
 *             res = self.min - d1 + self.d1_max
 *         elif (i0 == i1) and (j0 == j1):             # <<<<<<<<<<<<<<
 *             res = self.data[i0 * self.r + j0]
 *         elif i0 == i1:
 */
  __pyx_t_3 = (__pyx_v_i0 == __pyx_v_i1);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_j0 == __pyx_v_j1);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {
 105:             res = self.data[i0 * self.r + j0]
    /* "bilinear.pyx":105
 *             res = self.min - d1 + self.d1_max
 *         elif (i0 == i1) and (j0 == j1):
 *             res = self.data[i0 * self.r + j0]             # <<<<<<<<<<<<<<
 *         elif i0 == i1:
 *             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))
 */
    __pyx_v_res = (((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]);
    goto __pyx_L5;
  }
 106:         elif i0 == i1:
  /* "bilinear.pyx":106
 *         elif (i0 == i1) and (j0 == j1):
 *             res = self.data[i0 * self.r + j0]
 *         elif i0 == i1:             # <<<<<<<<<<<<<<
 *             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))
 *         elif j0 == j1:
 */
  __pyx_t_5 = (__pyx_v_i0 == __pyx_v_i1);
  if (__pyx_t_5) {
 107:             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))
    /* "bilinear.pyx":107
 *             res = self.data[i0 * self.r + j0]
 *         elif i0 == i1:
 *             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))             # <<<<<<<<<<<<<<
 *         elif j0 == j1:
 *             res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0))
 */
    __pyx_v_res = (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_y1 - __pyx_v_d1)) + ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_d1 - __pyx_v_y0)));
    goto __pyx_L5;
  }
 108:         elif j0 == j1:
  /* "bilinear.pyx":108
 *         elif i0 == i1:
 *             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))
 *         elif j0 == j1:             # <<<<<<<<<<<<<<
 *             res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0))
 *         else:
 */
  __pyx_t_5 = (__pyx_v_j0 == __pyx_v_j1);
  if (__pyx_t_5) {
 109:             res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0))
    /* "bilinear.pyx":109
 *             res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0))
 *         elif j0 == j1:
 *             res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0))             # <<<<<<<<<<<<<<
 *         else:
 *             res = (self.data[i0 * self.r + j0] * (x1 - d0) * (y1 - d1))  \
 */
    __pyx_v_res = (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_x1 - __pyx_v_d0)) + ((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_d0 - __pyx_v_x0)));
    goto __pyx_L5;
  }
  /*else*/ {
 110:         else:
 111:             res = (self.data[i0 * self.r + j0] * (x1 - d0) * (y1 - d1))  \
 112:                 + (self.data[i1 * self.r + j0] * (d0 - x0) * (y1 - d1))  \
 113:                 + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0))  \
 114:                 + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0))
    /* "bilinear.pyx":114
 *                 + (self.data[i1 * self.r + j0] * (d0 - x0) * (y1 - d1))  \
 *                 + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0))  \
 *                 + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0))             # <<<<<<<<<<<<<<
 *         return - res
 */
    __pyx_v_res = ((((((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_x1 - __pyx_v_d0)) * (__pyx_v_y1 - __pyx_v_d1)) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j0)]) * (__pyx_v_d0 - __pyx_v_x0)) * (__pyx_v_y1 - __pyx_v_d1))) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i0 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_x1 - __pyx_v_d0)) * (__pyx_v_d1 - __pyx_v_y0))) + (((((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->data[((__pyx_v_i1 * ((struct __pyx_obj_8bilinear_bilinear *)__pyx_v_self)->r) + __pyx_v_j1)]) * (__pyx_v_d0 - __pyx_v_x0)) * (__pyx_v_d1 - __pyx_v_y0)));
  }
  __pyx_L5:;
 115:         return - res
  /* "bilinear.pyx":115
 *                 + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0))  \
 *                 + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0))
 *         return - res             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_res)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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("bilinear.bilinear.f_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
pyfai-0.3.5/src/splitPixel.pyx0000644001611600065110000004270311656053703015503 0ustar kieffersoft#!/usr/bin/env python # -*- coding: utf8 -*- # # Project: Azimuthal integration # https://forge.epn-campus.eu/projects/azimuthal # # File: "$Id$" # # Copyright (C) European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # import cython cimport numpy import numpy cdef extern from "math.h": double floor(double)nogil double fabs(double)nogil cdef extern from "stdlib.h": void free(void * ptr)nogil void * calloc(size_t nmemb, size_t size)nogil void * malloc(size_t size)nogil ctypedef numpy.int64_t DTYPE_int64_t ctypedef numpy.float64_t DTYPE_float64_t cdef double areaTriangle(double a0, double a1, double b0, double b1, double c0, double c1): """ Calculate the area of the ABC triangle with corners: A(a0,a1) B(b0,b1) C(c0,c1) @return: area, i.e. 1/2 * (B-A)^(C-A) """ return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0))) cdef double areaQuad(double a0, double a1, double b0, double b1, double c0, double c1, double d0, double d1 ): """ Calculate the area of the ABCD quadrilataire with corners: A(a0,a1) B(b0,b1) C(c0,c1) D(d0,d1) @return: area, i.e. 1/2 * (AC ^ BD) """ return 0.5 * abs(((c0 - a0) * (d1 - b1)) - ((c1 - a1) * (d0 - b0))) @cython.cdivision(True) cdef double getBinNr(double x0, double pos0_min, double dpos) nogil: """ calculate the bin number for any point param x0: current position param pos0_min: position minimum param dpos: bin width """ return (x0 - pos0_min) / dpos cdef double min4f(double a, double b, double c, double d) nogil: 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): return c else: return d cdef double max4f(double a, double b, double c, double d) nogil: """Calculates the max of 4 double numbers""" 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): return c else: return d @cython.cdivision(True) @cython.boundscheck(False) @cython.wraparound(False) def fullSplit1D(numpy.ndarray pos not None, numpy.ndarray weights not None, long bins=100, pos0Range=None, pos1Range=None, double dummy=0.0 ): """ Calculates histogram of pos weighted by weights Splitting is done on the pixel's bounding box like fit2D @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi @param weights: array with intensities @param bins: number of output bins @param pos0Range: minimum and maximum of the 2th range @param pos1Range: minimum and maximum of the chi range @param dummy: value for bins without pixels @return 2theta, I, weighted histogram, unweighted histogram """ assert pos.shape[0] == weights.size assert pos.shape[1] == 4 assert pos.shape[2] == 2 assert pos.ndim == 3 assert bins > 1 cdef long size = weights.size cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") cdef double min0, max0, deltaR, deltaL, deltaA cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin if pos0Range is not None and len(pos0Range) > 1: pos0_min = min(pos0Range) pos0_maxin = max(pos0Range) else: pos0_min = pos[:, :, 0].min() pos0_maxin = pos[:, :, 0].max() pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) if pos1Range is not None and len(pos1Range) > 1: pos1_min = min(pos1Range) pos1_maxin = max(pos1Range) else: pos1_min = pos[:, :, 1].min() pos1_max = pos[:, :, 1].max() pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) cdef long bin = 0 cdef long i, idx cdef double fbin0_min, fbin0_max#, fbin1_min, fbin1_max cdef long bin0_max, bin0_min cdef double aeraPixel, a0, b0, c0, d0 cdef double epsilon = 1e-10 with nogil: for i in range(bins): outPos[i] = pos0_min + (0.5 +< double > i) * dpos for idx in range(size): data = < double > cdata[idx] a0 = < double > cpos[idx, 0, 0] b0 = < double > cpos[idx, 1, 0] c0 = < double > cpos[idx, 2, 0] d0 = < double > cpos[idx, 3, 0] min0 = min4f(a0, b0, c0, d0) max0 = max4f(a0, b0, c0, d0) fbin0_min = getBinNr(min0, pos0_min, dpos) fbin0_max = getBinNr(max0, pos0_min, dpos) bin0_min = < long > floor(fbin0_min) bin0_max = < long > floor(fbin0_max) if bin0_min == bin0_max: #All pixel is within a single bin outCount[bin0_min] += 1.0 outData[bin0_min] += data # else we have pixel spliting. else: aeraPixel = fbin0_max - fbin0_min deltaA = 1.0 / aeraPixel deltaL = < double > (bin0_min + 1) - fbin0_min deltaR = fbin0_max - (< double > bin0_max) outCount[bin0_min] += deltaA * deltaL outData[bin0_min] += data * deltaA * deltaL outCount[bin0_max] += deltaA * deltaR outData[bin0_max] += data * deltaA * deltaR if bin0_min + 1 != bin0_max: for i in range(bin0_min + 1, bin0_max): outCount[i] += deltaA outData[i] += data * deltaA for i in range(bins): if outCount[i] > epsilon: outMerge[i] = outData[i] / outCount[i] else: outMerge[i] = dummy return outPos, outMerge, outData, outCount @cython.cdivision(True) @cython.boundscheck(False) @cython.wraparound(False) def fullSplit2D(numpy.ndarray pos not None, numpy.ndarray weights not None, bins not None, pos0Range=None, pos1Range=None, double dummy=0.0): """ Calculate 2D histogram of pos weighted by weights Splitting is done on the pixel's bounding box like fit2D @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi @param weights: array with intensities @param bins: number of output bins int or 2-tuple of int @param pos0Range: minimum and maximum of the 2th range @param pos1Range: minimum and maximum of the chi range @param dummy: value for bins without pixels @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D) """ cdef long bins0, bins1, i, j, idx cdef long size = weights.size assert pos.shape[0] == weights.size assert pos.shape[1] == 4 # 4 corners assert pos.shape[2] == 2 # tth and chi assert pos.ndim == 3 try: bins0, bins1 = tuple(bins) except: bins0 = bins1 = < long > bins if bins0 <= 0: bins0 = 1 if bins1 <= 0: bins1 = 1 cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64") cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64") cdef double min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA cdef double pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin cdef double fbin0_min, fbin0_max, fbin1_min, fbin1_max cdef long bin0_max, bin0_min, bin1_max, bin1_min cdef double aeraPixel, a0, a1, b0, b1, c0, c1, d0, d1 cdef double epsilon = 1e-10 if pos0Range is not None and len(pos0Range) == 2: pos0_min = min(pos0Range) pos0_maxin = max(pos0Range) else: pos0_min = pos[:, :, 0].min() pos0_maxin = pos[:, :, 0].max() pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) if pos1Range is not None and len(pos1Range) > 1: pos1_min = min(pos1Range) pos1_maxin = max(pos1Range) else: pos1_min = pos[:, :, 1].min() pos1_maxin = pos[:, :, 1].max() pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0)) cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1)) with nogil: for i in range(bins0): edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 for i in range(bins1): edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 for idx in range(size): data = < double > cdata[idx] a0 = < double > cpos[idx, 0, 0] a1 = < double > cpos[idx, 0, 1] b0 = < double > cpos[idx, 1, 0] b1 = < double > cpos[idx, 1, 1] c0 = < double > cpos[idx, 2, 0] c1 = < double > cpos[idx, 2, 1] d0 = < double > cpos[idx, 3, 0] d1 = < double > cpos[idx, 3, 1] min0 = min4f(a0, b0, c0, d0) max0 = max4f(a0, b0, c0, d0) min1 = min4f(a1, b1, c1, d1) max1 = max4f(a1, b1, c1, d1) # splitOnePixel2D(min0, max0, min1, max1, # data, # pos0_min, pos1_min, # dpos0, dpos1, # outCount, # outData) if max0 < pos0_min: with gil: print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) continue if max1 < pos1_min: with gil: print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) continue if min0 > pos0_maxin: with gil: print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) continue if min1 > pos1_maxin: with gil: print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) continue if min0 < pos0_min: data = data * (pos0_min - min0) / (max0 - min0) min0 = pos0_min if min1 < pos1_min: data = data * (pos1_min - min1) / (max1 - min1) min1 = pos1_min if max0 > pos0_maxin: data = data * (max0 - pos0_maxin) / (max0 - min0) max0 = pos0_maxin if max1 > pos1_maxin: data = data * (max1 - pos1_maxin) / (max1 - min1) max1 = pos1_maxin ## treat data for pixel on chi discontinuity if ((max1 - min1) / dpos1) > (bins1 / 2.0): # with gil: # print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1)) if pos1_maxin - max1 > min1 - pos1_min: min1 = max1 max1 = pos1_maxin else: max1 = min1 min1 = pos1_min fbin0_min = getBinNr(min0, pos0_min, dpos0) fbin0_max = getBinNr(max0, pos0_min, dpos0) fbin1_min = getBinNr(min1, pos1_min, dpos1) fbin1_max = getBinNr(max1, pos1_min, dpos1) bin0_min = < long > floor(fbin0_min) bin0_max = < long > floor(fbin0_max) bin1_min = < long > floor(fbin1_min) bin1_max = < long > floor(fbin1_max) if bin0_min == bin0_max: if bin1_min == bin1_max: #All pixel is within a single bin outCount[bin0_min, bin1_min] += 1.0 outData[bin0_min, bin1_min] += data else: #spread on more than 2 bins aeraPixel = fbin1_max - fbin1_min deltaD = (< double > (bin1_min + 1)) - fbin1_min deltaU = fbin1_max - (< double > bin1_max) deltaA = 1.0 / aeraPixel outCount[bin0_min, bin1_min] += deltaA * deltaD outData[bin0_min, bin1_min] += data * deltaA * deltaD outCount[bin0_min, bin1_max] += deltaA * deltaU outData[bin0_min, bin1_max] += data * deltaA * deltaU # if bin1_min +1< bin1_max: for j in range(bin1_min + 1, bin1_max): outCount[bin0_min, j] += deltaA outData[bin0_min, j] += data * deltaA else: #spread on more than 2 bins in dim 0 if bin1_min == bin1_max: #All pixel fall on 1 bins in dim 1 aeraPixel = fbin0_max - fbin0_min deltaL = (< double > (bin0_min + 1)) - fbin0_min deltaA = deltaL / aeraPixel outCount[bin0_min, bin1_min] += deltaA outData[bin0_min, bin1_min] += data * deltaA deltaR = fbin0_max - (< double > bin0_max) deltaA = deltaR / aeraPixel outCount[bin0_max, bin1_min] += deltaA outData[bin0_max, bin1_min] += data * deltaA deltaA = 1.0 / aeraPixel for i in range(bin0_min + 1, bin0_max): outCount[i, bin1_min] += deltaA outData[i, bin1_min] += data * deltaA else: #spread on n pix in dim0 and m pixel in dim1: aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min) deltaL = (< double > (bin0_min + 1)) - fbin0_min deltaR = fbin0_max - (< double > bin0_max) deltaD = (< double > (bin1_min + 1)) - fbin1_min deltaU = fbin1_max - (< double > bin1_max) deltaA = 1.0 / aeraPixel outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU for i in range(bin0_min + 1, bin0_max): outCount[i, bin1_min] += deltaA * deltaD outData[i, bin1_min] += data * deltaA * deltaD for j in range(bin1_min + 1, bin1_max): outCount[i, j] += deltaA outData[i, j] += data * deltaA outCount[i, bin1_max] += deltaA * deltaU outData[i, bin1_max] += data * deltaA * deltaU for j in range(bin1_min + 1, bin1_max): outCount[bin0_min, j] += deltaA * deltaL outData[bin0_min, j] += data * deltaA * deltaL outCount[bin0_max, j] += deltaA * deltaR outData[bin0_max, j] += data * deltaA * deltaR #with nogil: for i in range(bins0): for j in range(bins1): if outCount[i, j] > epsilon: outMerge[i, j] = outData[i, j] / outCount[i, j] else: outMerge[i, j] = dummy return outMerge.T, edges0, edges1, outData.T, outCount.T pyfai-0.3.5/src/splitBBox.c0000644001611600065110000161721011656557527014675 0ustar kieffersoft/* Generated by Cython 0.15.1+ on Wed Nov 9 08:54:07 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif /* new Py3.3 unicode representation (PEP 393) */ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) #define CYTHON_PEP393_ENABLED #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #else #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__splitBBox #define __PYX_HAVE_API__splitBBox #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "splitBBox.pyx", "numpy.pxd", }; /* "numpy.pxd":719 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":720 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":721 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":722 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":726 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":727 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":728 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":729 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":733 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":734 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":743 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":744 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":745 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":747 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":748 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":749 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":751 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":752 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":754 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":755 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":756 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "splitBBox.pyx":36 * * * ctypedef numpy.int64_t DTYPE_int64_t # <<<<<<<<<<<<<< * ctypedef numpy.float64_t DTYPE_float64_t * ctypedef numpy.float32_t DTYPE_float32_t */ typedef __pyx_t_5numpy_int64_t __pyx_t_9splitBBox_DTYPE_int64_t; /* "splitBBox.pyx":37 * * ctypedef numpy.int64_t DTYPE_int64_t * ctypedef numpy.float64_t DTYPE_float64_t # <<<<<<<<<<<<<< * ctypedef numpy.float32_t DTYPE_float32_t * */ typedef __pyx_t_5numpy_float64_t __pyx_t_9splitBBox_DTYPE_float64_t; /* "splitBBox.pyx":38 * ctypedef numpy.int64_t DTYPE_int64_t * ctypedef numpy.float64_t DTYPE_float64_t * ctypedef numpy.float32_t DTYPE_float32_t # <<<<<<<<<<<<<< * * */ typedef __pyx_t_5numpy_float32_t __pyx_t_9splitBBox_DTYPE_float32_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":758 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":759 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":760 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":762 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define IS_UNSIGNED(type) (((type) -1) > 0) /* Run-time type information about structs used with buffers */ struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; int is_complex; char enc_type; char new_packmode; char enc_packmode; } __Pyx_BufFmt_Context; static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ /* structs for buffer access */ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[32]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'splitBBox' */ static float __pyx_f_9splitBBox_getBinNr(float, float, float); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t = { "DTYPE_float64_t", NULL, sizeof(__pyx_t_9splitBBox_DTYPE_float64_t), 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t = { "DTYPE_float32_t", NULL, sizeof(__pyx_t_9splitBBox_DTYPE_float32_t), 'R', 0, 0 }; #define __Pyx_MODULE_NAME "splitBBox" int __pyx_module_is_main_splitBBox = 0; /* Implementation of 'splitBBox' */ static PyObject *__pyx_builtin_min; static PyObject *__pyx_builtin_max; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_12[] = "ndarray is not C contiguous"; static char __pyx_k_14[] = "ndarray is not Fortran contiguous"; static char __pyx_k_16[] = "Non-native byte order not supported"; static char __pyx_k_18[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_19[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_22[] = "Format string allocated too short."; static char __pyx_k_26[] = "/home/kieffer/workspace-ssd/azimuthal/pyFAI/src/splitBBox.pyx"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__T[] = "T"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__bin[] = "bin"; static char __pyx_k__eps[] = "eps"; static char __pyx_k__idx[] = "idx"; static char __pyx_k__max[] = "max"; static char __pyx_k__min[] = "min"; static char __pyx_k__tmp[] = "tmp"; static char __pyx_k__bins[] = "bins"; static char __pyx_k__data[] = "data"; static char __pyx_k__dpos[] = "dpos"; static char __pyx_k__max0[] = "max0"; static char __pyx_k__max1[] = "max1"; static char __pyx_k__min0[] = "min0"; static char __pyx_k__min1[] = "min1"; static char __pyx_k__pos0[] = "pos0"; static char __pyx_k__pos1[] = "pos1"; static char __pyx_k__size[] = "size"; static char __pyx_k__bins0[] = "bins0"; static char __pyx_k__bins1[] = "bins1"; static char __pyx_k__cdata[] = "cdata"; static char __pyx_k__cpos0[] = "cpos0"; static char __pyx_k__cpos1[] = "cpos1"; static char __pyx_k__dpos0[] = "dpos0"; static char __pyx_k__dpos1[] = "dpos1"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__dummy[] = "dummy"; static char __pyx_k__finfo[] = "finfo"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__ravel[] = "ravel"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__astype[] = "astype"; static char __pyx_k__deltaA[] = "deltaA"; static char __pyx_k__deltaD[] = "deltaD"; static char __pyx_k__deltaL[] = "deltaL"; static char __pyx_k__deltaR[] = "deltaR"; static char __pyx_k__deltaU[] = "deltaU"; static char __pyx_k__edges0[] = "edges0"; static char __pyx_k__edges1[] = "edges1"; static char __pyx_k__outPos[] = "outPos"; static char __pyx_k__epsilon[] = "epsilon"; static char __pyx_k__float32[] = "float32"; static char __pyx_k__float64[] = "float64"; static char __pyx_k__outData[] = "outData"; static char __pyx_k__weights[] = "weights"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__bin0_max[] = "bin0_max"; static char __pyx_k__bin0_min[] = "bin0_min"; static char __pyx_k__bin1_max[] = "bin1_max"; static char __pyx_k__bin1_min[] = "bin1_min"; static char __pyx_k__outCount[] = "outCount"; static char __pyx_k__outMerge[] = "outMerge"; static char __pyx_k__pos0_max[] = "pos0_max"; static char __pyx_k__pos0_min[] = "pos0_min"; static char __pyx_k__pos1_max[] = "pos1_max"; static char __pyx_k__pos1_min[] = "pos1_min"; static char __pyx_k__checkpos1[] = "checkpos1"; static char __pyx_k__cpos0_inf[] = "cpos0_inf"; static char __pyx_k__cpos0_sup[] = "cpos0_sup"; static char __pyx_k__cpos1_inf[] = "cpos1_inf"; static char __pyx_k__cpos1_sup[] = "cpos1_sup"; static char __pyx_k__fbin0_max[] = "fbin0_max"; static char __pyx_k__fbin0_min[] = "fbin0_min"; static char __pyx_k__fbin1_max[] = "fbin1_max"; static char __pyx_k__fbin1_min[] = "fbin1_min"; static char __pyx_k__pos0Range[] = "pos0Range"; static char __pyx_k__pos1Range[] = "pos1Range"; static char __pyx_k__splitBBox[] = "splitBBox"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__delta_pos0[] = "delta_pos0"; static char __pyx_k__delta_pos1[] = "delta_pos1"; static char __pyx_k__pos0_maxin[] = "pos0_maxin"; static char __pyx_k__pos1_maxin[] = "pos1_maxin"; static char __pyx_k__cdelta_pos0[] = "cdelta_pos0"; static char __pyx_k__cdelta_pos1[] = "cdelta_pos1"; static char __pyx_k__histoBBox1d[] = "histoBBox1d"; static char __pyx_k__histoBBox2d[] = "histoBBox2d"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_14; static PyObject *__pyx_kp_u_16; static PyObject *__pyx_kp_u_18; static PyObject *__pyx_kp_u_19; static PyObject *__pyx_kp_u_22; static PyObject *__pyx_kp_s_26; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__astype; static PyObject *__pyx_n_s__bin; static PyObject *__pyx_n_s__bin0_max; static PyObject *__pyx_n_s__bin0_min; static PyObject *__pyx_n_s__bin1_max; static PyObject *__pyx_n_s__bin1_min; static PyObject *__pyx_n_s__bins; static PyObject *__pyx_n_s__bins0; static PyObject *__pyx_n_s__bins1; static PyObject *__pyx_n_s__cdata; static PyObject *__pyx_n_s__cdelta_pos0; static PyObject *__pyx_n_s__cdelta_pos1; static PyObject *__pyx_n_s__checkpos1; static PyObject *__pyx_n_s__cpos0; static PyObject *__pyx_n_s__cpos0_inf; static PyObject *__pyx_n_s__cpos0_sup; static PyObject *__pyx_n_s__cpos1; static PyObject *__pyx_n_s__cpos1_inf; static PyObject *__pyx_n_s__cpos1_sup; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__deltaA; static PyObject *__pyx_n_s__deltaD; static PyObject *__pyx_n_s__deltaL; static PyObject *__pyx_n_s__deltaR; static PyObject *__pyx_n_s__deltaU; static PyObject *__pyx_n_s__delta_pos0; static PyObject *__pyx_n_s__delta_pos1; static PyObject *__pyx_n_s__dpos; static PyObject *__pyx_n_s__dpos0; static PyObject *__pyx_n_s__dpos1; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__dummy; static PyObject *__pyx_n_s__edges0; static PyObject *__pyx_n_s__edges1; static PyObject *__pyx_n_s__eps; static PyObject *__pyx_n_s__epsilon; static PyObject *__pyx_n_s__fbin0_max; static PyObject *__pyx_n_s__fbin0_min; static PyObject *__pyx_n_s__fbin1_max; static PyObject *__pyx_n_s__fbin1_min; static PyObject *__pyx_n_s__finfo; static PyObject *__pyx_n_s__float32; static PyObject *__pyx_n_s__float64; static PyObject *__pyx_n_s__histoBBox1d; static PyObject *__pyx_n_s__histoBBox2d; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__idx; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__max; static PyObject *__pyx_n_s__max0; static PyObject *__pyx_n_s__max1; static PyObject *__pyx_n_s__min; static PyObject *__pyx_n_s__min0; static PyObject *__pyx_n_s__min1; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__outCount; static PyObject *__pyx_n_s__outData; static PyObject *__pyx_n_s__outMerge; static PyObject *__pyx_n_s__outPos; static PyObject *__pyx_n_s__pos0; static PyObject *__pyx_n_s__pos0Range; static PyObject *__pyx_n_s__pos0_max; static PyObject *__pyx_n_s__pos0_maxin; static PyObject *__pyx_n_s__pos0_min; static PyObject *__pyx_n_s__pos1; static PyObject *__pyx_n_s__pos1Range; static PyObject *__pyx_n_s__pos1_max; static PyObject *__pyx_n_s__pos1_maxin; static PyObject *__pyx_n_s__pos1_min; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__ravel; static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__splitBBox; static PyObject *__pyx_n_s__tmp; static PyObject *__pyx_n_s__weights; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; static PyObject *__pyx_int_36; static PyObject *__pyx_int_100; static PyObject *__pyx_k_tuple_1; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_7; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_20; static PyObject *__pyx_k_tuple_21; static PyObject *__pyx_k_tuple_23; static PyObject *__pyx_k_tuple_24; static PyObject *__pyx_k_tuple_27; static PyObject *__pyx_k_codeobj_25; static PyObject *__pyx_k_codeobj_28; /* "splitBBox.pyx":42 * * @cython.cdivision(True) * cdef float getBinNr(float x0, float pos0_min, float dpos) nogil: # <<<<<<<<<<<<<< * """ * calculate the bin number for any point */ static float __pyx_f_9splitBBox_getBinNr(float __pyx_v_x0, float __pyx_v_pos0_min, float __pyx_v_dpos) { float __pyx_r; /* "splitBBox.pyx":49 * param dpos: bin width * """ * return (x0 - pos0_min) / dpos # <<<<<<<<<<<<<< * * */ __pyx_r = ((__pyx_v_x0 - __pyx_v_pos0_min) / __pyx_v_dpos); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "splitBBox.pyx":55 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox1d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9splitBBox_histoBBox1d[] = "\n Calculates histogram of pos0 (tth) weighted by weights\n \n Splitting is done on the pixel's bounding box like fit2D\n \n @param weights: array with intensities\n @param pos0: 1D array with pos0: tth or q_vect\n @param delta_pos0: 1D array with delta pos0: max center-corner distance\n @param pos1: 1D array with pos1: chi\n @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! \n @param bins: number of output bins\n @param pos0Range: minimum and maximum of the 2th range\n @param pos1Range: minimum and maximum of the chi range\n @param dummy: value for bins without pixels \n @return 2theta, I, weighted histogram, unweighted histogram\n "; static PyMethodDef __pyx_mdef_9splitBBox_histoBBox1d = {__Pyx_NAMESTR("histoBBox1d"), (PyCFunction)__pyx_pf_9splitBBox_histoBBox1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9splitBBox_histoBBox1d)}; static PyObject *__pyx_pf_9splitBBox_histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_weights = 0; PyArrayObject *__pyx_v_pos0 = 0; PyArrayObject *__pyx_v_delta_pos0 = 0; PyObject *__pyx_v_pos1 = 0; PyObject *__pyx_v_delta_pos1 = 0; long __pyx_v_bins; PyObject *__pyx_v_pos0Range = 0; PyObject *__pyx_v_pos1Range = 0; float __pyx_v_dummy; long __pyx_v_size; PyArrayObject *__pyx_v_cdata = 0; PyArrayObject *__pyx_v_cpos0_inf = 0; PyArrayObject *__pyx_v_cpos0_sup = 0; PyArrayObject *__pyx_v_cpos1_inf = 0; PyArrayObject *__pyx_v_cpos1_sup = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_outPos = 0; float __pyx_v_deltaR; float __pyx_v_deltaL; float __pyx_v_deltaA; float __pyx_v_pos0_min; float __pyx_v_pos0_max; float __pyx_v_pos0_maxin; float __pyx_v_pos1_min; float __pyx_v_pos1_max; float __pyx_v_pos1_maxin; float __pyx_v_min0; float __pyx_v_max0; float __pyx_v_fbin0_min; float __pyx_v_fbin0_max; int __pyx_v_checkpos1; float __pyx_v_dpos; CYTHON_UNUSED long __pyx_v_bin; long __pyx_v_i; long __pyx_v_idx; long __pyx_v_bin0_max; long __pyx_v_bin0_min; double __pyx_v_epsilon; double __pyx_v_data; __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge; __Pyx_Buffer __pyx_pybuffer_outMerge; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_inf; __Pyx_Buffer __pyx_pybuffer_cpos0_inf; __Pyx_LocalBuf_ND __pyx_pybuffernd_outPos; __Pyx_Buffer __pyx_pybuffer_outPos; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_sup; __Pyx_Buffer __pyx_pybuffer_cpos0_sup; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_sup; __Pyx_Buffer __pyx_pybuffer_cpos1_sup; __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount; __Pyx_Buffer __pyx_pybuffer_outCount; __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata; __Pyx_Buffer __pyx_pybuffer_cdata; __Pyx_LocalBuf_ND __pyx_pybuffernd_outData; __Pyx_Buffer __pyx_pybuffer_outData; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_inf; __Pyx_Buffer __pyx_pybuffer_cpos1_inf; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; long __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyArrayObject *__pyx_t_6 = NULL; PyArrayObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; PyArrayObject *__pyx_t_12 = NULL; PyArrayObject *__pyx_t_13 = NULL; Py_ssize_t __pyx_t_14; int __pyx_t_15; int __pyx_t_16; float __pyx_t_17; PyArrayObject *__pyx_t_18 = NULL; int __pyx_t_19; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyArrayObject *__pyx_t_23 = NULL; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; long __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; long __pyx_t_37; long __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("histoBBox1d"); __pyx_self = __pyx_self; { PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; /* "splitBBox.pyx":58 * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, * pos1=None, # <<<<<<<<<<<<<< * delta_pos1=None, * long bins=100, */ values[3] = ((PyObject *)Py_None); /* "splitBBox.pyx":59 * numpy.ndarray delta_pos0 not None, * pos1=None, * delta_pos1=None, # <<<<<<<<<<<<<< * long bins=100, * pos0Range=None, */ values[4] = ((PyObject *)Py_None); /* "splitBBox.pyx":61 * delta_pos1=None, * long bins=100, * pos0Range=None, # <<<<<<<<<<<<<< * pos1Range=None, * float dummy=0.0 */ values[6] = ((PyObject *)Py_None); /* "splitBBox.pyx":62 * long bins=100, * pos0Range=None, * pos1Range=None, # <<<<<<<<<<<<<< * float dummy=0.0 * ): */ values[7] = ((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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); 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: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range); if (value) { values[6] = value; kw_args--; } } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range); if (value) { values[7] = value; kw_args--; } } case 8: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[8] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_weights = ((PyArrayObject *)values[0]); __pyx_v_pos0 = ((PyArrayObject *)values[1]); __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]); __pyx_v_pos1 = values[3]; __pyx_v_delta_pos1 = values[4]; if (values[5]) { __pyx_v_bins = __Pyx_PyInt_AsLong(values[5]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_bins = ((long)100); } __pyx_v_pos0Range = values[6]; __pyx_v_pos1Range = values[7]; if (values[8]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "splitBBox.pyx":63 * pos0Range=None, * pos1Range=None, * float dummy=0.0 # <<<<<<<<<<<<<< * ): * """ */ __pyx_v_dummy = ((float)0.0); } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); 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); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_weights = ((PyArrayObject *)values[0]); __pyx_v_pos0 = ((PyArrayObject *)values[1]); __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]); __pyx_v_pos1 = values[3]; __pyx_v_delta_pos1 = values[4]; if (values[5]) { __pyx_v_bins = __Pyx_PyInt_AsLong(values[5]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_bins = ((long)100); } __pyx_v_pos0Range = values[6]; __pyx_v_pos1Range = values[7]; if (values[8]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_dummy = ((float)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("splitBBox.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_pybuffer_cdata.pybuffer.buf = NULL; __pyx_pybuffer_cdata.refcount = 0; __pyx_pybuffernd_cdata.data = NULL; __pyx_pybuffernd_cdata.rcbuffer = &__pyx_pybuffer_cdata; __pyx_pybuffer_cpos0_inf.pybuffer.buf = NULL; __pyx_pybuffer_cpos0_inf.refcount = 0; __pyx_pybuffernd_cpos0_inf.data = NULL; __pyx_pybuffernd_cpos0_inf.rcbuffer = &__pyx_pybuffer_cpos0_inf; __pyx_pybuffer_cpos0_sup.pybuffer.buf = NULL; __pyx_pybuffer_cpos0_sup.refcount = 0; __pyx_pybuffernd_cpos0_sup.data = NULL; __pyx_pybuffernd_cpos0_sup.rcbuffer = &__pyx_pybuffer_cpos0_sup; __pyx_pybuffer_cpos1_inf.pybuffer.buf = NULL; __pyx_pybuffer_cpos1_inf.refcount = 0; __pyx_pybuffernd_cpos1_inf.data = NULL; __pyx_pybuffernd_cpos1_inf.rcbuffer = &__pyx_pybuffer_cpos1_inf; __pyx_pybuffer_cpos1_sup.pybuffer.buf = NULL; __pyx_pybuffer_cpos1_sup.refcount = 0; __pyx_pybuffernd_cpos1_sup.data = NULL; __pyx_pybuffernd_cpos1_sup.rcbuffer = &__pyx_pybuffer_cpos1_sup; __pyx_pybuffer_outData.pybuffer.buf = NULL; __pyx_pybuffer_outData.refcount = 0; __pyx_pybuffernd_outData.data = NULL; __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData; __pyx_pybuffer_outCount.pybuffer.buf = NULL; __pyx_pybuffer_outCount.refcount = 0; __pyx_pybuffernd_outCount.data = NULL; __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount; __pyx_pybuffer_outMerge.pybuffer.buf = NULL; __pyx_pybuffer_outMerge.refcount = 0; __pyx_pybuffernd_outMerge.data = NULL; __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge; __pyx_pybuffer_outPos.pybuffer.buf = NULL; __pyx_pybuffer_outPos.refcount = 0; __pyx_pybuffernd_outPos.data = NULL; __pyx_pybuffernd_outPos.rcbuffer = &__pyx_pybuffer_outPos; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "splitBBox.pyx":81 * @return 2theta, I, weighted histogram, unweighted histogram * """ * cdef long size = weights.size # <<<<<<<<<<<<<< * assert pos0.size == size * assert delta_pos0.size == size */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_2; /* "splitBBox.pyx":82 * """ * cdef long size = weights.size * assert pos0.size == size # <<<<<<<<<<<<<< * assert delta_pos0.size == size * assert bins > 1 */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":83 * cdef long size = weights.size * assert pos0.size == size * assert delta_pos0.size == size # <<<<<<<<<<<<<< * assert bins > 1 * */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":84 * assert pos0.size == size * assert delta_pos0.size == size * assert bins > 1 # <<<<<<<<<<<<<< * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_bins > 1))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":86 * assert bins > 1 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":87 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos0_inf.diminfo[0].strides = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_inf.diminfo[0].shape = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.shape[0]; } } __pyx_t_7 = 0; __pyx_v_cpos0_inf = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":88 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos0_sup.diminfo[0].strides = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_sup.diminfo[0].shape = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.shape[0]; } } __pyx_t_8 = 0; __pyx_v_cpos0_sup = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":92 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0]; } } __pyx_t_10 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; /* "splitBBox.pyx":93 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32") */ __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0]; } } __pyx_t_11 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":94 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32") * cdef float deltaR, deltaL, deltaA */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0]; } } __pyx_t_12 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":95 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32") # <<<<<<<<<<<<<< * cdef float deltaR, deltaL, deltaA * cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __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 = 95; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outPos.diminfo[0].strides = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outPos.diminfo[0].shape = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.shape[0]; } } __pyx_t_13 = 0; __pyx_v_outPos = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; /* "splitBBox.pyx":98 * cdef float deltaR, deltaL, deltaA * cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max * cdef int checkpos1 = 0 # <<<<<<<<<<<<<< * * if pos0Range is not None and len(pos0Range) > 1: */ __pyx_v_checkpos1 = 0; /* "splitBBox.pyx":100 * cdef int checkpos1 = 0 * * if pos0Range is not None and len(pos0Range) > 1: # <<<<<<<<<<<<<< * pos0_min = min(pos0Range) * if pos0_min < 0.0: */ __pyx_t_5 = (__pyx_v_pos0Range != Py_None); if (__pyx_t_5) { __pyx_t_14 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = (__pyx_t_14 > 1); __pyx_t_16 = __pyx_t_15; } else { __pyx_t_16 = __pyx_t_5; } if (__pyx_t_16) { /* "splitBBox.pyx":101 * * if pos0Range is not None and len(pos0Range) > 1: * pos0_min = min(pos0Range) # <<<<<<<<<<<<<< * if pos0_min < 0.0: * pos0_min = 0.0 */ __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos0_min = __pyx_t_17; /* "splitBBox.pyx":102 * if pos0Range is not None and len(pos0Range) > 1: * pos0_min = min(pos0Range) * if pos0_min < 0.0: # <<<<<<<<<<<<<< * pos0_min = 0.0 * pos0_maxin = max(pos0Range) */ __pyx_t_16 = (__pyx_v_pos0_min < 0.0); if (__pyx_t_16) { /* "splitBBox.pyx":103 * pos0_min = min(pos0Range) * if pos0_min < 0.0: * pos0_min = 0.0 # <<<<<<<<<<<<<< * pos0_maxin = max(pos0Range) * else: */ __pyx_v_pos0_min = 0.0; goto __pyx_L7; } __pyx_L7:; /* "splitBBox.pyx":104 * if pos0_min < 0.0: * pos0_min = 0.0 * pos0_maxin = max(pos0Range) # <<<<<<<<<<<<<< * else: * pos0_min = cpos0_inf.min() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_9 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_pos0_maxin = __pyx_t_17; goto __pyx_L6; } /*else*/ { /* "splitBBox.pyx":106 * pos0_maxin = max(pos0Range) * else: * pos0_min = cpos0_inf.min() # <<<<<<<<<<<<<< * pos0_maxin = cpos0_sup.max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) */ __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_inf), __pyx_n_s__min); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos0_min = __pyx_t_17; /* "splitBBox.pyx":107 * else: * pos0_min = cpos0_inf.min() * pos0_maxin = cpos0_sup.max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) * */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_sup), __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_pos0_maxin = __pyx_t_17; } __pyx_L6:; /* "splitBBox.pyx":108 * pos0_min = cpos0_inf.min() * pos0_maxin = cpos0_sup.max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) # <<<<<<<<<<<<<< * * if pos1Range is not None and len(pos1Range) > 1: */ __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__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 = 108; __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos0_max = __pyx_t_17; /* "splitBBox.pyx":110 * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) * * if pos1Range is not None and len(pos1Range) > 1: # <<<<<<<<<<<<<< * assert pos1.size == size * assert delta_pos1.size == size */ __pyx_t_16 = (__pyx_v_pos1Range != Py_None); if (__pyx_t_16) { __pyx_t_14 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = (__pyx_t_14 > 1); __pyx_t_15 = __pyx_t_5; } else { __pyx_t_15 = __pyx_t_16; } if (__pyx_t_15) { /* "splitBBox.pyx":111 * * if pos1Range is not None and len(pos1Range) > 1: * assert pos1.size == size # <<<<<<<<<<<<<< * assert delta_pos1.size == size * checkpos1 = 1 */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_15)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":112 * if pos1Range is not None and len(pos1Range) > 1: * assert pos1.size == size * assert delta_pos1.size == size # <<<<<<<<<<<<<< * checkpos1 = 1 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_9 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_15)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":113 * assert pos1.size == size * assert delta_pos1.size == size * checkpos1 = 1 # <<<<<<<<<<<<<< * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") */ __pyx_v_checkpos1 = 1; /* "splitBBox.pyx":114 * assert delta_pos1.size == size * checkpos1 = 1 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") # <<<<<<<<<<<<<< * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") * pos1_min = min(pos1Range) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __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_9); __pyx_t_9 = 0; __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_18 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer); __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_19 < 0)) { PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_v_cpos1_inf, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22); } } __pyx_pybuffernd_cpos1_inf.diminfo[0].strides = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_inf.diminfo[0].shape = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_18 = 0; __pyx_v_cpos1_inf = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":115 * checkpos1 = 1 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") # <<<<<<<<<<<<<< * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_23 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer); __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_19 < 0)) { PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_v_cpos1_sup, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20); } } __pyx_pybuffernd_cpos1_sup.diminfo[0].strides = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_sup.diminfo[0].shape = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_23 = 0; __pyx_v_cpos1_sup = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":116 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") * pos1_min = min(pos1Range) # <<<<<<<<<<<<<< * pos1_maxin = max(pos1Range) * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_min = __pyx_t_17; /* "splitBBox.pyx":117 * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos1_maxin = __pyx_t_17; /* "splitBBox.pyx":118 * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) # <<<<<<<<<<<<<< * * cdef float dpos = (pos0_max - pos0_min) / (< float > (bins)) */ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_max = __pyx_t_17; goto __pyx_L8; } __pyx_L8:; /* "splitBBox.pyx":120 * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) * * cdef float dpos = (pos0_max - pos0_min) / (< float > (bins)) # <<<<<<<<<<<<<< * cdef long bin = 0 * cdef long i, idx */ __pyx_v_dpos = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins)); /* "splitBBox.pyx":121 * * cdef float dpos = (pos0_max - pos0_min) / (< float > (bins)) * cdef long bin = 0 # <<<<<<<<<<<<<< * cdef long i, idx * cdef long bin0_max, bin0_min */ __pyx_v_bin = 0; /* "splitBBox.pyx":124 * cdef long i, idx * cdef long bin0_max, bin0_min * cdef double epsilon = 1e-10 # <<<<<<<<<<<<<< * * with nogil: */ __pyx_v_epsilon = 1e-10; /* "splitBBox.pyx":126 * cdef double epsilon = 1e-10 * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< float > i) * dpos */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "splitBBox.pyx":127 * * with nogil: * for i in range(bins): # <<<<<<<<<<<<<< * outPos[i] = pos0_min + (0.5 +< float > i) * dpos * */ __pyx_t_2 = __pyx_v_bins; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) { __pyx_v_i = __pyx_t_24; /* "splitBBox.pyx":128 * with nogil: * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< float > i) * dpos # <<<<<<<<<<<<<< * * for idx in range(size): */ __pyx_t_25 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outPos.diminfo[0].strides) = (__pyx_v_pos0_min + ((0.5 + ((float)__pyx_v_i)) * __pyx_v_dpos)); } /* "splitBBox.pyx":130 * outPos[i] = pos0_min + (0.5 +< float > i) * dpos * * for idx in range(size): # <<<<<<<<<<<<<< * data = < double > cdata[idx] * min0 = cpos0_inf[idx] */ __pyx_t_2 = __pyx_v_size; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) { __pyx_v_idx = __pyx_t_24; /* "splitBBox.pyx":131 * * for idx in range(size): * data = < double > cdata[idx] # <<<<<<<<<<<<<< * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] */ __pyx_t_26 = __pyx_v_idx; __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_cdata.diminfo[0].strides))); /* "splitBBox.pyx":132 * for idx in range(size): * data = < double > cdata[idx] * min0 = cpos0_inf[idx] # <<<<<<<<<<<<<< * max0 = cpos0_sup[idx] * if checkpos1: */ __pyx_t_27 = __pyx_v_idx; __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_cpos0_inf.diminfo[0].strides)); /* "splitBBox.pyx":133 * data = < double > cdata[idx] * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] # <<<<<<<<<<<<<< * if checkpos1: * if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max): */ __pyx_t_28 = __pyx_v_idx; __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_cpos0_sup.diminfo[0].strides)); /* "splitBBox.pyx":134 * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] * if checkpos1: # <<<<<<<<<<<<<< * if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max): * continue */ if (__pyx_v_checkpos1) { /* "splitBBox.pyx":135 * max0 = cpos0_sup[idx] * if checkpos1: * if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max): # <<<<<<<<<<<<<< * continue * */ __pyx_t_29 = __pyx_v_idx; __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_cpos1_inf.diminfo[0].strides)) < __pyx_v_pos1_min); if (!__pyx_t_15) { __pyx_t_30 = __pyx_v_idx; __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos1_sup.diminfo[0].strides)) > __pyx_v_pos1_max); __pyx_t_5 = __pyx_t_16; } else { __pyx_t_5 = __pyx_t_15; } if (__pyx_t_5) { /* "splitBBox.pyx":136 * if checkpos1: * if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max): * continue # <<<<<<<<<<<<<< * * fbin0_min = getBinNr(min0, pos0_min, dpos) */ goto __pyx_L14_continue; goto __pyx_L17; } __pyx_L17:; goto __pyx_L16; } __pyx_L16:; /* "splitBBox.pyx":138 * continue * * fbin0_min = getBinNr(min0, pos0_min, dpos) # <<<<<<<<<<<<<< * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) */ __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos); /* "splitBBox.pyx":139 * * fbin0_min = getBinNr(min0, pos0_min, dpos) * fbin0_max = getBinNr(max0, pos0_min, dpos) # <<<<<<<<<<<<<< * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) */ __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos); /* "splitBBox.pyx":140 * fbin0_min = getBinNr(min0, pos0_min, dpos) * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) # <<<<<<<<<<<<<< * bin0_max = < long > floor(fbin0_max) * */ __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min)); /* "splitBBox.pyx":141 * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) # <<<<<<<<<<<<<< * * if bin0_min == bin0_max: */ __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max)); /* "splitBBox.pyx":143 * bin0_max = < long > floor(fbin0_max) * * if bin0_min == bin0_max: # <<<<<<<<<<<<<< * #All pixel is within a single bin * outCount[bin0_min] += < double > 1.0 */ __pyx_t_5 = (__pyx_v_bin0_min == __pyx_v_bin0_max); if (__pyx_t_5) { /* "splitBBox.pyx":145 * if bin0_min == bin0_max: * #All pixel is within a single bin * outCount[bin0_min] += < double > 1.0 # <<<<<<<<<<<<<< * outData[bin0_min] += < double > data * */ __pyx_t_31 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_outCount.diminfo[0].strides) += ((double)1.0); /* "splitBBox.pyx":146 * #All pixel is within a single bin * outCount[bin0_min] += < double > 1.0 * outData[bin0_min] += < double > data # <<<<<<<<<<<<<< * * else: #we have pixel spliting. */ __pyx_t_32 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_outData.diminfo[0].strides) += ((double)__pyx_v_data); goto __pyx_L18; } /*else*/ { /* "splitBBox.pyx":149 * * else: #we have pixel spliting. * deltaA = 1.0 / (fbin0_max - fbin0_min) # <<<<<<<<<<<<<< * * deltaL = < float > (bin0_min + 1) - fbin0_min */ __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min)); /* "splitBBox.pyx":151 * deltaA = 1.0 / (fbin0_max - fbin0_min) * * deltaL = < float > (bin0_min + 1) - fbin0_min # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< float > bin0_max) * */ __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitBBox.pyx":152 * * deltaL = < float > (bin0_min + 1) - fbin0_min * deltaR = fbin0_max - (< float > bin0_max) # <<<<<<<<<<<<<< * * outCount[bin0_min] += < double > deltaA * deltaL */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max)); /* "splitBBox.pyx":154 * deltaR = fbin0_max - (< float > bin0_max) * * outCount[bin0_min] += < double > deltaA * deltaL # <<<<<<<<<<<<<< * outData[bin0_min] += < double > data * deltaA * deltaL * */ __pyx_t_33 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outCount.diminfo[0].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":155 * * outCount[bin0_min] += < double > deltaA * deltaL * outData[bin0_min] += < double > data * deltaA * deltaL # <<<<<<<<<<<<<< * * outCount[bin0_max] += < double > deltaA * deltaR */ __pyx_t_34 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_outData.diminfo[0].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":157 * outData[bin0_min] += < double > data * deltaA * deltaL * * outCount[bin0_max] += < double > deltaA * deltaR # <<<<<<<<<<<<<< * outData[bin0_max] += < double > data * deltaA * deltaR * */ __pyx_t_35 = __pyx_v_bin0_max; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_outCount.diminfo[0].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR); /* "splitBBox.pyx":158 * * outCount[bin0_max] += < double > deltaA * deltaR * outData[bin0_max] += < double > data * deltaA * deltaR # <<<<<<<<<<<<<< * * if bin0_min + 1 < bin0_max: */ __pyx_t_36 = __pyx_v_bin0_max; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_outData.diminfo[0].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR); /* "splitBBox.pyx":160 * outData[bin0_max] += < double > data * deltaA * deltaR * * if bin0_min + 1 < bin0_max: # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i] += < double > deltaA */ __pyx_t_5 = ((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max); if (__pyx_t_5) { /* "splitBBox.pyx":161 * * if bin0_min + 1 < bin0_max: * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i] += < double > deltaA * outData[i] += data * < double > deltaA */ __pyx_t_37 = __pyx_v_bin0_max; for (__pyx_t_38 = (__pyx_v_bin0_min + 1); __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) { __pyx_v_i = __pyx_t_38; /* "splitBBox.pyx":162 * if bin0_min + 1 < bin0_max: * for i in range(bin0_min + 1, bin0_max): * outCount[i] += < double > deltaA # <<<<<<<<<<<<<< * outData[i] += data * < double > deltaA * */ __pyx_t_39 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount.diminfo[0].strides) += ((double)__pyx_v_deltaA); /* "splitBBox.pyx":163 * for i in range(bin0_min + 1, bin0_max): * outCount[i] += < double > deltaA * outData[i] += data * < double > deltaA # <<<<<<<<<<<<<< * * for i in range(bins): */ __pyx_t_40 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_outData.diminfo[0].strides) += (__pyx_v_data * ((double)__pyx_v_deltaA)); } goto __pyx_L19; } __pyx_L19:; } __pyx_L18:; __pyx_L14_continue:; } /* "splitBBox.pyx":165 * outData[i] += data * < double > deltaA * * for i in range(bins): # <<<<<<<<<<<<<< * if outCount[i] > epsilon: * outMerge[i] = < float > (outData[i] / outCount[i]) */ __pyx_t_2 = __pyx_v_bins; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) { __pyx_v_i = __pyx_t_24; /* "splitBBox.pyx":166 * * for i in range(bins): * if outCount[i] > epsilon: # <<<<<<<<<<<<<< * outMerge[i] = < float > (outData[i] / outCount[i]) * else: */ __pyx_t_37 = __pyx_v_i; __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon); if (__pyx_t_5) { /* "splitBBox.pyx":167 * for i in range(bins): * if outCount[i] > epsilon: * outMerge[i] = < float > (outData[i] / outCount[i]) # <<<<<<<<<<<<<< * else: * outMerge[i] = dummy */ __pyx_t_38 = __pyx_v_i; __pyx_t_41 = __pyx_v_i; __pyx_t_42 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_outMerge.diminfo[0].strides) = ((float)((*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_outData.diminfo[0].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_outCount.diminfo[0].strides)))); goto __pyx_L24; } /*else*/ { /* "splitBBox.pyx":169 * outMerge[i] = < float > (outData[i] / outCount[i]) * else: * outMerge[i] = dummy # <<<<<<<<<<<<<< * * return outPos, outMerge, outData, outCount */ __pyx_t_43 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outMerge.diminfo[0].strides) = __pyx_v_dummy; } __pyx_L24:; } } /* "splitBBox.pyx":126 * cdef double epsilon = 1e-10 * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< float > i) * dpos */ /*finally:*/ { Py_BLOCK_THREADS } } /* "splitBBox.pyx":171 * outMerge[i] = dummy * * return outPos, outMerge, outData, outCount # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_outPos)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos)); __Pyx_INCREF(((PyObject *)__pyx_v_outMerge)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge)); __Pyx_INCREF(((PyObject *)__pyx_v_outData)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_outData)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outData)); __Pyx_INCREF(((PyObject *)__pyx_v_outCount)); PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount)); __pyx_r = ((PyObject *)__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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("splitBBox.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cdata); __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_inf); __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_sup); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_inf); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_sup); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_outPos); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "splitBBox.pyx":179 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox2d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ static PyObject *__pyx_pf_9splitBBox_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9splitBBox_1histoBBox2d[] = "\n Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights\n \n Splitting is done on the pixel's bounding box like fit2D\n \n\n @param weights: array with intensities\n @param pos0: 1D array with pos0: tth or q_vect\n @param delta_pos0: 1D array with delta pos0: max center-corner distance\n @param pos1: 1D array with pos1: chi\n @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! \n @param bins: number of output bins (tth=100, chi=36 by default)\n @param pos0Range: minimum and maximum of the 2th range\n @param pos1Range: minimum and maximum of the chi range\n @param dummy: value for bins without pixels \n @return 2theta, I, weighted histogram, unweighted histogram\n @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n "; static PyMethodDef __pyx_mdef_9splitBBox_1histoBBox2d = {__Pyx_NAMESTR("histoBBox2d"), (PyCFunction)__pyx_pf_9splitBBox_1histoBBox2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9splitBBox_1histoBBox2d)}; static PyObject *__pyx_pf_9splitBBox_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_weights = 0; PyArrayObject *__pyx_v_pos0 = 0; PyArrayObject *__pyx_v_delta_pos0 = 0; PyArrayObject *__pyx_v_pos1 = 0; PyArrayObject *__pyx_v_delta_pos1 = 0; PyObject *__pyx_v_bins = 0; PyObject *__pyx_v_pos0Range = 0; PyObject *__pyx_v_pos1Range = 0; float __pyx_v_dummy; long __pyx_v_bins0; long __pyx_v_bins1; long __pyx_v_i; long __pyx_v_j; long __pyx_v_idx; long __pyx_v_size; PyArrayObject *__pyx_v_cdata = 0; PyArrayObject *__pyx_v_cpos0 = 0; PyArrayObject *__pyx_v_cdelta_pos0 = 0; PyArrayObject *__pyx_v_cpos0_inf = 0; PyArrayObject *__pyx_v_cpos0_sup = 0; PyArrayObject *__pyx_v_cpos1 = 0; PyArrayObject *__pyx_v_cdelta_pos1 = 0; PyArrayObject *__pyx_v_cpos1_inf = 0; PyArrayObject *__pyx_v_cpos1_sup = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_edges0 = 0; PyArrayObject *__pyx_v_edges1 = 0; float __pyx_v_min0; float __pyx_v_max0; float __pyx_v_min1; float __pyx_v_max1; float __pyx_v_deltaR; float __pyx_v_deltaL; float __pyx_v_deltaU; float __pyx_v_deltaD; float __pyx_v_deltaA; float __pyx_v_tmp; float __pyx_v_pos0_min; float __pyx_v_pos0_max; float __pyx_v_pos1_min; float __pyx_v_pos1_max; float __pyx_v_pos0_maxin; float __pyx_v_pos1_maxin; float __pyx_v_fbin0_min; float __pyx_v_fbin0_max; float __pyx_v_fbin1_min; float __pyx_v_fbin1_max; long __pyx_v_bin0_max; long __pyx_v_bin0_min; long __pyx_v_bin1_max; long __pyx_v_bin1_min; double __pyx_v_epsilon; double __pyx_v_data; float __pyx_v_dpos0; float __pyx_v_dpos1; __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge; __Pyx_Buffer __pyx_pybuffer_outMerge; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_inf; __Pyx_Buffer __pyx_pybuffer_cpos0_inf; __Pyx_LocalBuf_ND __pyx_pybuffernd_cdelta_pos1; __Pyx_Buffer __pyx_pybuffer_cdelta_pos1; __Pyx_LocalBuf_ND __pyx_pybuffernd_cdelta_pos0; __Pyx_Buffer __pyx_pybuffer_cdelta_pos0; __Pyx_LocalBuf_ND __pyx_pybuffernd_edges0; __Pyx_Buffer __pyx_pybuffer_edges0; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_sup; __Pyx_Buffer __pyx_pybuffer_cpos0_sup; __Pyx_LocalBuf_ND __pyx_pybuffernd_edges1; __Pyx_Buffer __pyx_pybuffer_edges1; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_sup; __Pyx_Buffer __pyx_pybuffer_cpos1_sup; __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount; __Pyx_Buffer __pyx_pybuffer_outCount; __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata; __Pyx_Buffer __pyx_pybuffer_cdata; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1; __Pyx_Buffer __pyx_pybuffer_cpos1; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0; __Pyx_Buffer __pyx_pybuffer_cpos0; __Pyx_LocalBuf_ND __pyx_pybuffernd_outData; __Pyx_Buffer __pyx_pybuffer_outData; __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_inf; __Pyx_Buffer __pyx_pybuffer_cpos1_inf; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; long __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; long __pyx_t_9; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; PyArrayObject *__pyx_t_12 = NULL; PyArrayObject *__pyx_t_13 = NULL; PyArrayObject *__pyx_t_14 = NULL; PyArrayObject *__pyx_t_15 = NULL; PyArrayObject *__pyx_t_16 = NULL; PyArrayObject *__pyx_t_17 = NULL; PyArrayObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyArrayObject *__pyx_t_20 = NULL; PyArrayObject *__pyx_t_21 = NULL; PyArrayObject *__pyx_t_22 = NULL; PyArrayObject *__pyx_t_23 = NULL; PyArrayObject *__pyx_t_24 = NULL; Py_ssize_t __pyx_t_25; int __pyx_t_26; int __pyx_t_27; float __pyx_t_28; double __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; int __pyx_t_37; int __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; long __pyx_t_44; long __pyx_t_45; long __pyx_t_46; long __pyx_t_47; long __pyx_t_48; long __pyx_t_49; long __pyx_t_50; long __pyx_t_51; long __pyx_t_52; long __pyx_t_53; long __pyx_t_54; long __pyx_t_55; long __pyx_t_56; long __pyx_t_57; long __pyx_t_58; long __pyx_t_59; long __pyx_t_60; long __pyx_t_61; long __pyx_t_62; long __pyx_t_63; long __pyx_t_64; long __pyx_t_65; long __pyx_t_66; long __pyx_t_67; long __pyx_t_68; long __pyx_t_69; long __pyx_t_70; long __pyx_t_71; long __pyx_t_72; long __pyx_t_73; long __pyx_t_74; long __pyx_t_75; long __pyx_t_76; long __pyx_t_77; long __pyx_t_78; long __pyx_t_79; long __pyx_t_80; long __pyx_t_81; long __pyx_t_82; long __pyx_t_83; long __pyx_t_84; long __pyx_t_85; long __pyx_t_86; long __pyx_t_87; long __pyx_t_88; long __pyx_t_89; long __pyx_t_90; long __pyx_t_91; long __pyx_t_92; long __pyx_t_93; long __pyx_t_94; long __pyx_t_95; long __pyx_t_96; long __pyx_t_97; long __pyx_t_98; long __pyx_t_99; long __pyx_t_100; long __pyx_t_101; long __pyx_t_102; long __pyx_t_103; long __pyx_t_104; long __pyx_t_105; long __pyx_t_106; long __pyx_t_107; long __pyx_t_108; long __pyx_t_109; long __pyx_t_110; long __pyx_t_111; long __pyx_t_112; long __pyx_t_113; long __pyx_t_114; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("histoBBox2d"); __pyx_self = __pyx_self; { PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; /* "splitBBox.pyx":184 * numpy.ndarray pos1 not None, * numpy.ndarray delta_pos1 not None, * bins=(100, 36), # <<<<<<<<<<<<<< * pos0Range=None, * pos1Range=None, */ values[5] = ((PyObject *)__pyx_k_tuple_6); /* "splitBBox.pyx":185 * numpy.ndarray delta_pos1 not None, * bins=(100, 36), * pos0Range=None, # <<<<<<<<<<<<<< * pos1Range=None, * float dummy=0.0): */ values[6] = ((PyObject *)Py_None); /* "splitBBox.pyx":186 * bins=(100, 36), * pos0Range=None, * pos1Range=None, # <<<<<<<<<<<<<< * float dummy=0.0): * """ */ values[7] = ((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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); 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: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1); if (likely(values[4])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range); if (value) { values[6] = value; kw_args--; } } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range); if (value) { values[7] = value; kw_args--; } } case 8: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[8] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_weights = ((PyArrayObject *)values[0]); __pyx_v_pos0 = ((PyArrayObject *)values[1]); __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]); __pyx_v_pos1 = ((PyArrayObject *)values[3]); __pyx_v_delta_pos1 = ((PyArrayObject *)values[4]); __pyx_v_bins = values[5]; __pyx_v_pos0Range = values[6]; __pyx_v_pos1Range = values[7]; if (values[8]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "splitBBox.pyx":187 * pos0Range=None, * pos1Range=None, * float dummy=0.0): # <<<<<<<<<<<<<< * """ * Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights */ __pyx_v_dummy = ((float)0.0); } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); 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); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_weights = ((PyArrayObject *)values[0]); __pyx_v_pos0 = ((PyArrayObject *)values[1]); __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]); __pyx_v_pos1 = ((PyArrayObject *)values[3]); __pyx_v_delta_pos1 = ((PyArrayObject *)values[4]); __pyx_v_bins = values[5]; __pyx_v_pos0Range = values[6]; __pyx_v_pos1Range = values[7]; if (values[8]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dummy == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_dummy = ((float)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_pybuffer_cdata.pybuffer.buf = NULL; __pyx_pybuffer_cdata.refcount = 0; __pyx_pybuffernd_cdata.data = NULL; __pyx_pybuffernd_cdata.rcbuffer = &__pyx_pybuffer_cdata; __pyx_pybuffer_cpos0.pybuffer.buf = NULL; __pyx_pybuffer_cpos0.refcount = 0; __pyx_pybuffernd_cpos0.data = NULL; __pyx_pybuffernd_cpos0.rcbuffer = &__pyx_pybuffer_cpos0; __pyx_pybuffer_cdelta_pos0.pybuffer.buf = NULL; __pyx_pybuffer_cdelta_pos0.refcount = 0; __pyx_pybuffernd_cdelta_pos0.data = NULL; __pyx_pybuffernd_cdelta_pos0.rcbuffer = &__pyx_pybuffer_cdelta_pos0; __pyx_pybuffer_cpos0_inf.pybuffer.buf = NULL; __pyx_pybuffer_cpos0_inf.refcount = 0; __pyx_pybuffernd_cpos0_inf.data = NULL; __pyx_pybuffernd_cpos0_inf.rcbuffer = &__pyx_pybuffer_cpos0_inf; __pyx_pybuffer_cpos0_sup.pybuffer.buf = NULL; __pyx_pybuffer_cpos0_sup.refcount = 0; __pyx_pybuffernd_cpos0_sup.data = NULL; __pyx_pybuffernd_cpos0_sup.rcbuffer = &__pyx_pybuffer_cpos0_sup; __pyx_pybuffer_cpos1.pybuffer.buf = NULL; __pyx_pybuffer_cpos1.refcount = 0; __pyx_pybuffernd_cpos1.data = NULL; __pyx_pybuffernd_cpos1.rcbuffer = &__pyx_pybuffer_cpos1; __pyx_pybuffer_cdelta_pos1.pybuffer.buf = NULL; __pyx_pybuffer_cdelta_pos1.refcount = 0; __pyx_pybuffernd_cdelta_pos1.data = NULL; __pyx_pybuffernd_cdelta_pos1.rcbuffer = &__pyx_pybuffer_cdelta_pos1; __pyx_pybuffer_cpos1_inf.pybuffer.buf = NULL; __pyx_pybuffer_cpos1_inf.refcount = 0; __pyx_pybuffernd_cpos1_inf.data = NULL; __pyx_pybuffernd_cpos1_inf.rcbuffer = &__pyx_pybuffer_cpos1_inf; __pyx_pybuffer_cpos1_sup.pybuffer.buf = NULL; __pyx_pybuffer_cpos1_sup.refcount = 0; __pyx_pybuffernd_cpos1_sup.data = NULL; __pyx_pybuffernd_cpos1_sup.rcbuffer = &__pyx_pybuffer_cpos1_sup; __pyx_pybuffer_outData.pybuffer.buf = NULL; __pyx_pybuffer_outData.refcount = 0; __pyx_pybuffernd_outData.data = NULL; __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData; __pyx_pybuffer_outCount.pybuffer.buf = NULL; __pyx_pybuffer_outCount.refcount = 0; __pyx_pybuffernd_outCount.data = NULL; __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount; __pyx_pybuffer_outMerge.pybuffer.buf = NULL; __pyx_pybuffer_outMerge.refcount = 0; __pyx_pybuffernd_outMerge.data = NULL; __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge; __pyx_pybuffer_edges0.pybuffer.buf = NULL; __pyx_pybuffer_edges0.refcount = 0; __pyx_pybuffernd_edges0.data = NULL; __pyx_pybuffernd_edges0.rcbuffer = &__pyx_pybuffer_edges0; __pyx_pybuffer_edges1.pybuffer.buf = NULL; __pyx_pybuffer_edges1.refcount = 0; __pyx_pybuffernd_edges1.data = NULL; __pyx_pybuffernd_edges1.rcbuffer = &__pyx_pybuffer_edges1; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos1), __pyx_ptype_5numpy_ndarray, 0, "pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos1), __pyx_ptype_5numpy_ndarray, 0, "delta_pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "splitBBox.pyx":208 * * cdef long bins0, bins1, i, j, idx * cdef long size = weights.size # <<<<<<<<<<<<<< * assert pos0.size == size * assert pos1.size == size */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_2; /* "splitBBox.pyx":209 * cdef long bins0, bins1, i, j, idx * cdef long size = weights.size * assert pos0.size == size # <<<<<<<<<<<<<< * assert pos1.size == size * assert delta_pos0.size == size */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":210 * cdef long size = weights.size * assert pos0.size == size * assert pos1.size == size # <<<<<<<<<<<<<< * assert delta_pos0.size == size * assert delta_pos1.size == size */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":211 * assert pos0.size == size * assert pos1.size == size * assert delta_pos0.size == size # <<<<<<<<<<<<<< * assert delta_pos1.size == size * try: */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":212 * assert pos1.size == size * assert delta_pos0.size == size * assert delta_pos1.size == size # <<<<<<<<<<<<<< * try: * bins0, bins1 = tuple(bins) */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitBBox.pyx":213 * assert delta_pos0.size == size * assert delta_pos1.size == size * try: # <<<<<<<<<<<<<< * bins0, bins1 = tuple(bins) * except: */ { __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:*/ { /* "splitBBox.pyx":214 * assert delta_pos1.size == size * try: * bins0, bins1 = tuple(bins) # <<<<<<<<<<<<<< * except: * bins0 = bins1 = < long > bins */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_bins); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bins); __Pyx_GIVEREF(__pyx_v_bins); __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (likely(PyTuple_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __Pyx_UnpackTupleError(__pyx_t_3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_bins0 = __pyx_t_2; __pyx_v_bins1 = __pyx_t_9; } __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_L13_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "splitBBox.pyx":215 * try: * bins0, bins1 = tuple(bins) * except: # <<<<<<<<<<<<<< * bins0 = bins1 = < long > bins * if bins0 <= 0: */ /*except:*/ { __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); /* "splitBBox.pyx":216 * bins0, bins1 = tuple(bins) * except: * bins0 = bins1 = < long > bins # <<<<<<<<<<<<<< * if bins0 <= 0: * bins0 = 1 */ __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __pyx_v_bins0 = ((long)__pyx_t_9); __pyx_v_bins1 = ((long)__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L7_exception_handled; } __pyx_L8_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_L7_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_L13_try_end:; } /* "splitBBox.pyx":217 * except: * bins0 = bins1 = < long > bins * if bins0 <= 0: # <<<<<<<<<<<<<< * bins0 = 1 * if bins1 <= 0: */ __pyx_t_5 = (__pyx_v_bins0 <= 0); if (__pyx_t_5) { /* "splitBBox.pyx":218 * bins0 = bins1 = < long > bins * if bins0 <= 0: * bins0 = 1 # <<<<<<<<<<<<<< * if bins1 <= 0: * bins1 = 1 */ __pyx_v_bins0 = 1; goto __pyx_L16; } __pyx_L16:; /* "splitBBox.pyx":219 * if bins0 <= 0: * bins0 = 1 * if bins1 <= 0: # <<<<<<<<<<<<<< * bins1 = 1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") */ __pyx_t_5 = (__pyx_v_bins1 <= 0); if (__pyx_t_5) { /* "splitBBox.pyx":220 * bins0 = 1 * if bins1 <= 0: * bins1 = 1 # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") */ __pyx_v_bins1 = 1; goto __pyx_L17; } __pyx_L17:; /* "splitBBox.pyx":221 * if bins1 <= 0: * bins1 = 1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0]; } } __pyx_t_10 = 0; __pyx_v_cdata = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":222 * bins1 = 1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 */ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __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__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos0.diminfo[0].strides = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0.diminfo[0].shape = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.shape[0]; } } __pyx_t_11 = 0; __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":223 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdelta_pos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cdelta_pos0.diminfo[0].strides = __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdelta_pos0.diminfo[0].shape = __pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer.shape[0]; } } __pyx_t_12 = 0; __pyx_v_cdelta_pos0 = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":224 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") */ __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_cpos0), ((PyObject *)__pyx_v_cdelta_pos0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos0_inf.diminfo[0].strides = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_inf.diminfo[0].shape = __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.shape[0]; } } __pyx_t_13 = 0; __pyx_v_cpos0_inf = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":225 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") */ __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_cpos0), ((PyObject *)__pyx_v_cdelta_pos0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos0_sup.diminfo[0].strides = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_sup.diminfo[0].shape = __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.shape[0]; } } __pyx_t_14 = 0; __pyx_v_cpos0_sup = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":226 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 */ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __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__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos1.diminfo[0].strides = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1.diminfo[0].shape = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.shape[0]; } } __pyx_t_15 = 0; __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":227 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdelta_pos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cdelta_pos1.diminfo[0].strides = __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdelta_pos1.diminfo[0].shape = __pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer.shape[0]; } } __pyx_t_16 = 0; __pyx_v_cdelta_pos1 = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":228 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_cpos1), ((PyObject *)__pyx_v_cdelta_pos1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos1_inf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos1_inf.diminfo[0].strides = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_inf.diminfo[0].shape = __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.shape[0]; } } __pyx_t_17 = 0; __pyx_v_cpos1_inf = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":229 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_cpos1), ((PyObject *)__pyx_v_cdelta_pos1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_18 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos1_sup = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_cpos1_sup.diminfo[0].strides = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_sup.diminfo[0].shape = __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.shape[0]; } } __pyx_t_18 = 0; __pyx_v_cpos1_sup = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":230 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_19)); __Pyx_GIVEREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_19 = PyDict_New(); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_19)); if (PyDict_SetItem(__pyx_t_19, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_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; __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outData.diminfo[1].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outData.diminfo[1].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[1]; } } __pyx_t_20 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":231 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_19 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_21 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outCount.diminfo[1].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outCount.diminfo[1].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[1]; } } __pyx_t_21 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":232 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_19)); __Pyx_GIVEREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_19 = PyDict_New(); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_19)); if (PyDict_SetItem(__pyx_t_19, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_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; __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_22 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMerge.diminfo[1].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMerge.diminfo[1].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[1]; } } __pyx_t_22 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitBBox.pyx":233 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32") * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_19 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_23 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edges0.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_edges0.diminfo[0].strides = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges0.diminfo[0].shape = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.shape[0]; } } __pyx_t_23 = 0; __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":234 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32") # <<<<<<<<<<<<<< * * cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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 = 234; __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 = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_19) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_19, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_24 = ((PyArrayObject *)__pyx_t_19); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_9splitBBox_DTYPE_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edges1.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_edges1.diminfo[0].strides = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges1.diminfo[0].shape = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.shape[0]; } } __pyx_t_24 = 0; __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_19); __pyx_t_19 = 0; /* "splitBBox.pyx":240 * cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max * cdef long bin0_max, bin0_min, bin1_max, bin1_min * cdef double epsilon = 1e-10 # <<<<<<<<<<<<<< * cdef double data * */ __pyx_v_epsilon = 1e-10; /* "splitBBox.pyx":243 * cdef double data * * if pos0Range is not None and len(pos0Range) == 2: # <<<<<<<<<<<<<< * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) */ __pyx_t_5 = (__pyx_v_pos0Range != Py_None); if (__pyx_t_5) { __pyx_t_25 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_26 = (__pyx_t_25 == 2); __pyx_t_27 = __pyx_t_26; } else { __pyx_t_27 = __pyx_t_5; } if (__pyx_t_27) { /* "splitBBox.pyx":244 * * if pos0Range is not None and len(pos0Range) == 2: * pos0_min = min(pos0Range) # <<<<<<<<<<<<<< * pos0_maxin = max(pos0Range) * else: */ __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos0_min = __pyx_t_28; /* "splitBBox.pyx":245 * if pos0Range is not None and len(pos0Range) == 2: * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) # <<<<<<<<<<<<<< * else: * pos0_min = max(0.0, cpos0_inf.min()) */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_19 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_v_pos0_maxin = __pyx_t_28; goto __pyx_L18; } /*else*/ { /* "splitBBox.pyx":247 * pos0_maxin = max(pos0Range) * else: * pos0_min = max(0.0, cpos0_inf.min()) # <<<<<<<<<<<<<< * pos0_maxin = cpos0_sup.max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) */ __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_inf), __pyx_n_s__min); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_29 = 0.0; __pyx_t_3 = PyFloat_FromDouble(__pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_27 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_27) { __Pyx_INCREF(__pyx_t_1); __pyx_t_19 = __pyx_t_1; } else { __pyx_t_4 = PyFloat_FromDouble(__pyx_t_29); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_19 = __pyx_t_4; __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_v_pos0_min = __pyx_t_28; /* "splitBBox.pyx":248 * else: * pos0_min = max(0.0, cpos0_inf.min()) * pos0_maxin = cpos0_sup.max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) * */ __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos0_sup), __pyx_n_s__max); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_1 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos0_maxin = __pyx_t_28; } __pyx_L18:; /* "splitBBox.pyx":249 * pos0_min = max(0.0, cpos0_inf.min()) * pos0_maxin = cpos0_sup.max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) # <<<<<<<<<<<<<< * * if pos1Range is not None and len(pos1Range) > 1: */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_4 = PyObject_GetAttr(__pyx_t_19, __pyx_n_s__finfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_3 = PyObject_GetAttr(__pyx_t_19, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_19 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_19); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_19 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_v_pos0_max = __pyx_t_28; /* "splitBBox.pyx":251 * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps) * * if pos1Range is not None and len(pos1Range) > 1: # <<<<<<<<<<<<<< * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) */ __pyx_t_27 = (__pyx_v_pos1Range != Py_None); if (__pyx_t_27) { __pyx_t_25 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = (__pyx_t_25 > 1); __pyx_t_26 = __pyx_t_5; } else { __pyx_t_26 = __pyx_t_27; } if (__pyx_t_26) { /* "splitBBox.pyx":252 * * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) # <<<<<<<<<<<<<< * pos1_maxin = max(pos1Range) * else: */ __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos1_min = __pyx_t_28; /* "splitBBox.pyx":253 * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) # <<<<<<<<<<<<<< * else: * tmp = cdelta_pos1.min() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_19 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_v_pos1_maxin = __pyx_t_28; goto __pyx_L19; } /*else*/ { /* "splitBBox.pyx":255 * pos1_maxin = max(pos1Range) * else: * tmp = cdelta_pos1.min() # <<<<<<<<<<<<<< * pos1_min = cpos1.min() - tmp * pos1_maxin = cpos1.max() + tmp */ __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_cdelta_pos1), __pyx_n_s__min); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_3 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_tmp = __pyx_t_28; /* "splitBBox.pyx":256 * else: * tmp = cdelta_pos1.min() * pos1_min = cpos1.min() - tmp # <<<<<<<<<<<<<< * pos1_maxin = cpos1.max() + tmp * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_19 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tmp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyNumber_Subtract(__pyx_t_19, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_min = __pyx_t_28; /* "splitBBox.pyx":257 * tmp = cdelta_pos1.min() * pos1_min = cpos1.min() - tmp * pos1_maxin = cpos1.max() + tmp # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) * */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __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 = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tmp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_19 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_v_pos1_maxin = __pyx_t_28; } __pyx_L19:; /* "splitBBox.pyx":258 * pos1_min = cpos1.min() - tmp * pos1_maxin = cpos1.max() + tmp * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) # <<<<<<<<<<<<<< * * cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0)) */ __pyx_t_19 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__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 = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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_t_19, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_max = __pyx_t_28; /* "splitBBox.pyx":260 * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps) * * cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0)) # <<<<<<<<<<<<<< * cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1)) * */ __pyx_v_dpos0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins0)); /* "splitBBox.pyx":261 * * cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0)) * cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1)) # <<<<<<<<<<<<<< * * with nogil: */ __pyx_v_dpos1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((float)__pyx_v_bins1)); /* "splitBBox.pyx":263 * cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1)) * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "splitBBox.pyx":264 * * with nogil: * for i in range(bins0): # <<<<<<<<<<<<<< * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): */ __pyx_t_9 = __pyx_v_bins0; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitBBox.pyx":265 * with nogil: * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 # <<<<<<<<<<<<<< * for i in range(bins1): * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 */ __pyx_t_30 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_edges0.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_edges0.diminfo[0].strides) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos0)); } /* "splitBBox.pyx":266 * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): # <<<<<<<<<<<<<< * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 * */ __pyx_t_9 = __pyx_v_bins1; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitBBox.pyx":267 * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 # <<<<<<<<<<<<<< * * for idx in range(size): */ __pyx_t_31 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_edges1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_edges1.diminfo[0].strides) = (__pyx_v_pos1_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos1)); } /* "splitBBox.pyx":269 * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 * * for idx in range(size): # <<<<<<<<<<<<<< * data = cdata[idx] * min0 = cpos0_inf[idx] */ __pyx_t_9 = __pyx_v_size; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_idx = __pyx_t_2; /* "splitBBox.pyx":270 * * for idx in range(size): * data = cdata[idx] # <<<<<<<<<<<<<< * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] */ __pyx_t_32 = __pyx_v_idx; __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_cdata.diminfo[0].strides)); /* "splitBBox.pyx":271 * for idx in range(size): * data = cdata[idx] * min0 = cpos0_inf[idx] # <<<<<<<<<<<<<< * max0 = cpos0_sup[idx] * min1 = cpos1_inf[idx] */ __pyx_t_33 = __pyx_v_idx; __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_cpos0_inf.diminfo[0].strides)); /* "splitBBox.pyx":272 * data = cdata[idx] * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] # <<<<<<<<<<<<<< * min1 = cpos1_inf[idx] * max1 = cpos1_sup[idx] */ __pyx_t_34 = __pyx_v_idx; __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cpos0_sup.diminfo[0].strides)); /* "splitBBox.pyx":273 * min0 = cpos0_inf[idx] * max0 = cpos0_sup[idx] * min1 = cpos1_inf[idx] # <<<<<<<<<<<<<< * max1 = cpos1_sup[idx] * */ __pyx_t_35 = __pyx_v_idx; __pyx_v_min1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos1_inf.diminfo[0].strides)); /* "splitBBox.pyx":274 * max0 = cpos0_sup[idx] * min1 = cpos1_inf[idx] * max1 = cpos1_sup[idx] # <<<<<<<<<<<<<< * * if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) : */ __pyx_t_36 = __pyx_v_idx; __pyx_v_max1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_cpos1_sup.diminfo[0].strides)); /* "splitBBox.pyx":276 * max1 = cpos1_sup[idx] * * if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) : # <<<<<<<<<<<<<< * continue * */ __pyx_t_26 = (__pyx_v_max0 < __pyx_v_pos0_min); if (!__pyx_t_26) { __pyx_t_27 = (__pyx_v_max1 < __pyx_v_pos1_min); if (!__pyx_t_27) { __pyx_t_5 = (__pyx_v_min0 > __pyx_v_pos0_maxin); if (!__pyx_t_5) { __pyx_t_37 = (__pyx_v_min1 > __pyx_v_pos1_maxin); __pyx_t_38 = __pyx_t_37; } else { __pyx_t_38 = __pyx_t_5; } __pyx_t_5 = __pyx_t_38; } else { __pyx_t_5 = __pyx_t_27; } __pyx_t_27 = __pyx_t_5; } else { __pyx_t_27 = __pyx_t_26; } if (__pyx_t_27) { /* "splitBBox.pyx":277 * * if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) : * continue # <<<<<<<<<<<<<< * * if min0 < pos0_min: */ goto __pyx_L27_continue; goto __pyx_L29; } __pyx_L29:; /* "splitBBox.pyx":279 * continue * * if min0 < pos0_min: # <<<<<<<<<<<<<< * min0 = pos0_min * if min1 < pos1_min: */ __pyx_t_27 = (__pyx_v_min0 < __pyx_v_pos0_min); if (__pyx_t_27) { /* "splitBBox.pyx":280 * * if min0 < pos0_min: * min0 = pos0_min # <<<<<<<<<<<<<< * if min1 < pos1_min: * min1 = pos1_min */ __pyx_v_min0 = __pyx_v_pos0_min; goto __pyx_L30; } __pyx_L30:; /* "splitBBox.pyx":281 * if min0 < pos0_min: * min0 = pos0_min * if min1 < pos1_min: # <<<<<<<<<<<<<< * min1 = pos1_min * if max0 > pos0_maxin: */ __pyx_t_27 = (__pyx_v_min1 < __pyx_v_pos1_min); if (__pyx_t_27) { /* "splitBBox.pyx":282 * min0 = pos0_min * if min1 < pos1_min: * min1 = pos1_min # <<<<<<<<<<<<<< * if max0 > pos0_maxin: * max0 = pos0_maxin */ __pyx_v_min1 = __pyx_v_pos1_min; goto __pyx_L31; } __pyx_L31:; /* "splitBBox.pyx":283 * if min1 < pos1_min: * min1 = pos1_min * if max0 > pos0_maxin: # <<<<<<<<<<<<<< * max0 = pos0_maxin * if max1 > pos1_maxin: */ __pyx_t_27 = (__pyx_v_max0 > __pyx_v_pos0_maxin); if (__pyx_t_27) { /* "splitBBox.pyx":284 * min1 = pos1_min * if max0 > pos0_maxin: * max0 = pos0_maxin # <<<<<<<<<<<<<< * if max1 > pos1_maxin: * max1 = pos1_maxin */ __pyx_v_max0 = __pyx_v_pos0_maxin; goto __pyx_L32; } __pyx_L32:; /* "splitBBox.pyx":285 * if max0 > pos0_maxin: * max0 = pos0_maxin * if max1 > pos1_maxin: # <<<<<<<<<<<<<< * max1 = pos1_maxin * */ __pyx_t_27 = (__pyx_v_max1 > __pyx_v_pos1_maxin); if (__pyx_t_27) { /* "splitBBox.pyx":286 * max0 = pos0_maxin * if max1 > pos1_maxin: * max1 = pos1_maxin # <<<<<<<<<<<<<< * * */ __pyx_v_max1 = __pyx_v_pos1_maxin; goto __pyx_L33; } __pyx_L33:; /* "splitBBox.pyx":289 * * * fbin0_min = getBinNr(min0, pos0_min, dpos0) # <<<<<<<<<<<<<< * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) */ __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos0); /* "splitBBox.pyx":290 * * fbin0_min = getBinNr(min0, pos0_min, dpos0) * fbin0_max = getBinNr(max0, pos0_min, dpos0) # <<<<<<<<<<<<<< * fbin1_min = getBinNr(min1, pos1_min, dpos1) * fbin1_max = getBinNr(max1, pos1_min, dpos1) */ __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos0); /* "splitBBox.pyx":291 * fbin0_min = getBinNr(min0, pos0_min, dpos0) * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) # <<<<<<<<<<<<<< * fbin1_max = getBinNr(max1, pos1_min, dpos1) * */ __pyx_v_fbin1_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_dpos1); /* "splitBBox.pyx":292 * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) * fbin1_max = getBinNr(max1, pos1_min, dpos1) # <<<<<<<<<<<<<< * * bin0_min = < long > floor(fbin0_min) */ __pyx_v_fbin1_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_dpos1); /* "splitBBox.pyx":294 * fbin1_max = getBinNr(max1, pos1_min, dpos1) * * bin0_min = < long > floor(fbin0_min) # <<<<<<<<<<<<<< * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) */ __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min)); /* "splitBBox.pyx":295 * * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) # <<<<<<<<<<<<<< * bin1_min = < long > floor(fbin1_min) * bin1_max = < long > floor(fbin1_max) */ __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max)); /* "splitBBox.pyx":296 * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) # <<<<<<<<<<<<<< * bin1_max = < long > floor(fbin1_max) * */ __pyx_v_bin1_min = ((long)floor(__pyx_v_fbin1_min)); /* "splitBBox.pyx":297 * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) * bin1_max = < long > floor(fbin1_max) # <<<<<<<<<<<<<< * * */ __pyx_v_bin1_max = ((long)floor(__pyx_v_fbin1_max)); /* "splitBBox.pyx":300 * * * if bin0_min == bin0_max: # <<<<<<<<<<<<<< * if bin1_min == bin1_max: * #All pixel is within a single bin */ __pyx_t_27 = (__pyx_v_bin0_min == __pyx_v_bin0_max); if (__pyx_t_27) { /* "splitBBox.pyx":301 * * if bin0_min == bin0_max: * if bin1_min == bin1_max: # <<<<<<<<<<<<<< * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 */ __pyx_t_27 = (__pyx_v_bin1_min == __pyx_v_bin1_max); if (__pyx_t_27) { /* "splitBBox.pyx":303 * if bin1_min == bin1_max: * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * else: */ __pyx_t_39 = __pyx_v_bin0_min; __pyx_t_40 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_outCount.diminfo[1].strides) += 1.0; /* "splitBBox.pyx":304 * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 * outData[bin0_min, bin1_min] += data # <<<<<<<<<<<<<< * else: * #spread on more than 2 bins */ __pyx_t_41 = __pyx_v_bin0_min; __pyx_t_42 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_outData.diminfo[1].strides) += __pyx_v_data; goto __pyx_L35; } /*else*/ { /* "splitBBox.pyx":307 * else: * #spread on more than 2 bins * deltaD = (< float > (bin1_min + 1)) - fbin1_min # <<<<<<<<<<<<<< * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / (fbin1_max - fbin1_min) */ __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min); /* "splitBBox.pyx":308 * #spread on more than 2 bins * deltaD = (< float > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) # <<<<<<<<<<<<<< * deltaA = 1.0 / (fbin1_max - fbin1_min) * */ __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max)); /* "splitBBox.pyx":309 * deltaD = (< float > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / (fbin1_max - fbin1_min) # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaD */ __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min)); /* "splitBBox.pyx":311 * deltaA = 1.0 / (fbin1_max - fbin1_min) * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaD # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * deltaA * deltaD * */ __pyx_t_43 = __pyx_v_bin0_min; __pyx_t_44 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaD); /* "splitBBox.pyx":312 * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaD * outData[bin0_min, bin1_min] += data * deltaA * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaU */ __pyx_t_45 = __pyx_v_bin0_min; __pyx_t_46 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD); /* "splitBBox.pyx":314 * outData[bin0_min, bin1_min] += data * deltaA * deltaD * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaU # <<<<<<<<<<<<<< * outData[bin0_min, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_47 = __pyx_v_bin0_min; __pyx_t_48 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaU); /* "splitBBox.pyx":315 * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaU * outData[bin0_min, bin1_max] += data * deltaA * deltaU # <<<<<<<<<<<<<< * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA */ __pyx_t_49 = __pyx_v_bin0_min; __pyx_t_50 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU); /* "splitBBox.pyx":316 * outCount[bin0_min, bin1_max] += < double > deltaA * deltaU * outData[bin0_min, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[bin0_min, j] += < double > deltaA * outData[bin0_min, j] += data * deltaA */ __pyx_t_51 = __pyx_v_bin1_max; for (__pyx_t_52 = (__pyx_v_bin1_min + 1); __pyx_t_52 < __pyx_t_51; __pyx_t_52+=1) { __pyx_v_j = __pyx_t_52; /* "splitBBox.pyx":317 * outData[bin0_min, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA # <<<<<<<<<<<<<< * outData[bin0_min, j] += data * deltaA * */ __pyx_t_53 = __pyx_v_bin0_min; __pyx_t_54 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_54, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA); /* "splitBBox.pyx":318 * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA * outData[bin0_min, j] += data * deltaA # <<<<<<<<<<<<<< * * else: #spread on more than 2 bins in dim 0 */ __pyx_t_55 = __pyx_v_bin0_min; __pyx_t_56 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA); } } __pyx_L35:; goto __pyx_L34; } /*else*/ { /* "splitBBox.pyx":321 * * else: #spread on more than 2 bins in dim 0 * if bin1_min == bin1_max: # <<<<<<<<<<<<<< * #All pixel fall on 1 bins in dim 1 * deltaA = 1.0 / (fbin0_max - fbin0_min) */ __pyx_t_27 = (__pyx_v_bin1_min == __pyx_v_bin1_max); if (__pyx_t_27) { /* "splitBBox.pyx":323 * if bin1_min == bin1_max: * #All pixel fall on 1 bins in dim 1 * deltaA = 1.0 / (fbin0_max - fbin0_min) # <<<<<<<<<<<<<< * deltaL = (< float > (bin0_min + 1)) - fbin0_min * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL */ __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min)); /* "splitBBox.pyx":324 * #All pixel fall on 1 bins in dim 1 * deltaA = 1.0 / (fbin0_max - fbin0_min) * deltaL = (< float > (bin0_min + 1)) - fbin0_min # <<<<<<<<<<<<<< * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL */ __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitBBox.pyx":325 * deltaA = 1.0 / (fbin0_max - fbin0_min) * deltaL = (< float > (bin0_min + 1)) - fbin0_min * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaR = fbin0_max - (< float > bin0_max) */ __pyx_t_51 = __pyx_v_bin0_min; __pyx_t_52 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":326 * deltaL = (< float > (bin0_min + 1)) - fbin0_min * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< float > bin0_max) * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR */ __pyx_t_57 = __pyx_v_bin0_min; __pyx_t_58 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":327 * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaR = fbin0_max - (< float > bin0_max) # <<<<<<<<<<<<<< * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max)); /* "splitBBox.pyx":328 * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaR = fbin0_max - (< float > bin0_max) * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR # <<<<<<<<<<<<<< * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * for i in range(bin0_min + 1, bin0_max): */ __pyx_t_59 = __pyx_v_bin0_max; __pyx_t_60 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR); /* "splitBBox.pyx":329 * deltaR = fbin0_max - (< float > bin0_max) * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA */ __pyx_t_61 = __pyx_v_bin0_max; __pyx_t_62 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR); /* "splitBBox.pyx":330 * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i, bin1_min] += < double > deltaA * outData[i, bin1_min] += < double > data * deltaA */ __pyx_t_63 = __pyx_v_bin0_max; for (__pyx_t_64 = (__pyx_v_bin0_min + 1); __pyx_t_64 < __pyx_t_63; __pyx_t_64+=1) { __pyx_v_i = __pyx_t_64; /* "splitBBox.pyx":331 * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA # <<<<<<<<<<<<<< * outData[i, bin1_min] += < double > data * deltaA * else: */ __pyx_t_65 = __pyx_v_i; __pyx_t_66 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA); /* "splitBBox.pyx":332 * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA * outData[i, bin1_min] += < double > data * deltaA # <<<<<<<<<<<<<< * else: * #spread on n pix in dim0 and m pixel in dim1: */ __pyx_t_67 = __pyx_v_i; __pyx_t_68 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_outData.diminfo[1].strides) += (((double)__pyx_v_data) * __pyx_v_deltaA); } goto __pyx_L38; } /*else*/ { /* "splitBBox.pyx":335 * else: * #spread on n pix in dim0 and m pixel in dim1: * deltaL = (< float > (bin0_min + 1)) - fbin0_min # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< float > bin0_max) * deltaD = (< float > (bin1_min + 1)) - fbin1_min */ __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitBBox.pyx":336 * #spread on n pix in dim0 and m pixel in dim1: * deltaL = (< float > (bin0_min + 1)) - fbin0_min * deltaR = fbin0_max - (< float > bin0_max) # <<<<<<<<<<<<<< * deltaD = (< float > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< float > bin1_max) */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max)); /* "splitBBox.pyx":337 * deltaL = (< float > (bin0_min + 1)) - fbin0_min * deltaR = fbin0_max - (< float > bin0_max) * deltaD = (< float > (bin1_min + 1)) - fbin1_min # <<<<<<<<<<<<<< * deltaU = fbin1_max - (< float > bin1_max) * deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min) */ __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min); /* "splitBBox.pyx":338 * deltaR = fbin0_max - (< float > bin0_max) * deltaD = (< float > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< float > bin1_max) # <<<<<<<<<<<<<< * deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min) * */ __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max)); /* "splitBBox.pyx":339 * deltaD = (< float > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< float > bin1_max) * deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min) # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD */ __pyx_v_deltaA = ((1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min)) / (__pyx_v_fbin1_max - __pyx_v_fbin1_min)); /* "splitBBox.pyx":341 * deltaA = 1.0 / (fbin0_max - fbin0_min) / (fbin1_max - fbin1_min) * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD * */ __pyx_t_63 = __pyx_v_bin0_min; __pyx_t_64 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD); /* "splitBBox.pyx":342 * * outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU */ __pyx_t_69 = __pyx_v_bin0_min; __pyx_t_70 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD); /* "splitBBox.pyx":344 * outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU # <<<<<<<<<<<<<< * outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU * */ __pyx_t_71 = __pyx_v_bin0_min; __pyx_t_72 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU); /* "splitBBox.pyx":345 * * outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU * outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU # <<<<<<<<<<<<<< * * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD */ __pyx_t_73 = __pyx_v_bin0_min; __pyx_t_74 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_74, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU); /* "splitBBox.pyx":347 * outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU * * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD # <<<<<<<<<<<<<< * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD * */ __pyx_t_75 = __pyx_v_bin0_max; __pyx_t_76 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD); /* "splitBBox.pyx":348 * * outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU */ __pyx_t_77 = __pyx_v_bin0_max; __pyx_t_78 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_78, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD); /* "splitBBox.pyx":350 * outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD * * outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU # <<<<<<<<<<<<<< * outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): */ __pyx_t_79 = __pyx_v_bin0_max; __pyx_t_80 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((((double)__pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU); /* "splitBBox.pyx":351 * * outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU * outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA * deltaD */ __pyx_t_81 = __pyx_v_bin0_max; __pyx_t_82 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_81, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_82, __pyx_pybuffernd_outData.diminfo[1].strides) += (((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU); /* "splitBBox.pyx":352 * outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU * outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i, bin1_min] += < double > deltaA * deltaD * outData[i, bin1_min] += < double > data * deltaA * deltaD */ __pyx_t_83 = __pyx_v_bin0_max; for (__pyx_t_84 = (__pyx_v_bin0_min + 1); __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) { __pyx_v_i = __pyx_t_84; /* "splitBBox.pyx":353 * outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA * deltaD # <<<<<<<<<<<<<< * outData[i, bin1_min] += < double > data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_85 = __pyx_v_i; __pyx_t_86 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaD); /* "splitBBox.pyx":354 * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += < double > deltaA * deltaD * outData[i, bin1_min] += < double > data * deltaA * deltaD # <<<<<<<<<<<<<< * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += < double > deltaA */ __pyx_t_87 = __pyx_v_i; __pyx_t_88 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaD); /* "splitBBox.pyx":355 * outCount[i, bin1_min] += < double > deltaA * deltaD * outData[i, bin1_min] += < double > data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[i, j] += < double > deltaA * outData[i, j] += < double > data * deltaA */ __pyx_t_89 = __pyx_v_bin1_max; for (__pyx_t_90 = (__pyx_v_bin1_min + 1); __pyx_t_90 < __pyx_t_89; __pyx_t_90+=1) { __pyx_v_j = __pyx_t_90; /* "splitBBox.pyx":356 * outData[i, bin1_min] += < double > data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += < double > deltaA # <<<<<<<<<<<<<< * outData[i, j] += < double > data * deltaA * outCount[i, bin1_max] += < double > deltaA * deltaU */ __pyx_t_91 = __pyx_v_i; __pyx_t_92 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_92, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((double)__pyx_v_deltaA); /* "splitBBox.pyx":357 * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += < double > deltaA * outData[i, j] += < double > data * deltaA # <<<<<<<<<<<<<< * outCount[i, bin1_max] += < double > deltaA * deltaU * outData[i, bin1_max] += < double > data * deltaA * deltaU */ __pyx_t_93 = __pyx_v_i; __pyx_t_94 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_94, __pyx_pybuffernd_outData.diminfo[1].strides) += (((double)__pyx_v_data) * __pyx_v_deltaA); } /* "splitBBox.pyx":358 * outCount[i, j] += < double > deltaA * outData[i, j] += < double > data * deltaA * outCount[i, bin1_max] += < double > deltaA * deltaU # <<<<<<<<<<<<<< * outData[i, bin1_max] += < double > data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_89 = __pyx_v_i; __pyx_t_90 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaU); /* "splitBBox.pyx":359 * outData[i, j] += < double > data * deltaA * outCount[i, bin1_max] += < double > deltaA * deltaU * outData[i, bin1_max] += < double > data * deltaA * deltaU # <<<<<<<<<<<<<< * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA * deltaL */ __pyx_t_95 = __pyx_v_i; __pyx_t_96 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaU); } /* "splitBBox.pyx":360 * outCount[i, bin1_max] += < double > deltaA * deltaU * outData[i, bin1_max] += < double > data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[bin0_min, j] += < double > deltaA * deltaL * outData[bin0_min, j] += < double > data * deltaA * deltaL */ __pyx_t_83 = __pyx_v_bin1_max; for (__pyx_t_84 = (__pyx_v_bin1_min + 1); __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) { __pyx_v_j = __pyx_t_84; /* "splitBBox.pyx":361 * outData[i, bin1_max] += < double > data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA * deltaL # <<<<<<<<<<<<<< * outData[bin0_min, j] += < double > data * deltaA * deltaL * */ __pyx_t_97 = __pyx_v_bin0_min; __pyx_t_98 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":362 * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += < double > deltaA * deltaL * outData[bin0_min, j] += < double > data * deltaA * deltaL # <<<<<<<<<<<<<< * * outCount[bin0_max, j] += < double > deltaA * deltaR */ __pyx_t_99 = __pyx_v_bin0_min; __pyx_t_100 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_99, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_100, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaL); /* "splitBBox.pyx":364 * outData[bin0_min, j] += < double > data * deltaA * deltaL * * outCount[bin0_max, j] += < double > deltaA * deltaR # <<<<<<<<<<<<<< * outData[bin0_max, j] += < double > data * deltaA * deltaR * */ __pyx_t_101 = __pyx_v_bin0_max; __pyx_t_102 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_101, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_102, __pyx_pybuffernd_outCount.diminfo[1].strides) += (((double)__pyx_v_deltaA) * __pyx_v_deltaR); /* "splitBBox.pyx":365 * * outCount[bin0_max, j] += < double > deltaA * deltaR * outData[bin0_max, j] += < double > data * deltaA * deltaR # <<<<<<<<<<<<<< * * for i in range(bins0): */ __pyx_t_103 = __pyx_v_bin0_max; __pyx_t_104 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_103, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_104, __pyx_pybuffernd_outData.diminfo[1].strides) += ((((double)__pyx_v_data) * __pyx_v_deltaA) * __pyx_v_deltaR); } } __pyx_L38:; } __pyx_L34:; __pyx_L27_continue:; } /* "splitBBox.pyx":367 * outData[bin0_max, j] += < double > data * deltaA * deltaR * * for i in range(bins0): # <<<<<<<<<<<<<< * for j in range(bins1): * if outCount[i, j] > epsilon: */ __pyx_t_9 = __pyx_v_bins0; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitBBox.pyx":368 * * for i in range(bins0): * for j in range(bins1): # <<<<<<<<<<<<<< * if outCount[i, j] > epsilon: * outMerge[i, j] = outData[i, j] / outCount[i, j] */ __pyx_t_83 = __pyx_v_bins1; for (__pyx_t_84 = 0; __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) { __pyx_v_j = __pyx_t_84; /* "splitBBox.pyx":369 * for i in range(bins0): * for j in range(bins1): * if outCount[i, j] > epsilon: # <<<<<<<<<<<<<< * outMerge[i, j] = outData[i, j] / outCount[i, j] * else: */ __pyx_t_105 = __pyx_v_i; __pyx_t_106 = __pyx_v_j; __pyx_t_27 = ((*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_105, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_106, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon); if (__pyx_t_27) { /* "splitBBox.pyx":370 * for j in range(bins1): * if outCount[i, j] > epsilon: * outMerge[i, j] = outData[i, j] / outCount[i, j] # <<<<<<<<<<<<<< * else: * outMerge[i, j] = dummy */ __pyx_t_107 = __pyx_v_i; __pyx_t_108 = __pyx_v_j; __pyx_t_109 = __pyx_v_i; __pyx_t_110 = __pyx_v_j; __pyx_t_111 = __pyx_v_i; __pyx_t_112 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_111, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_112, __pyx_pybuffernd_outMerge.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_107, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_108, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_outCount.diminfo[1].strides))); goto __pyx_L51; } /*else*/ { /* "splitBBox.pyx":372 * outMerge[i, j] = outData[i, j] / outCount[i, j] * else: * outMerge[i, j] = dummy # <<<<<<<<<<<<<< * return outMerge.T, edges0, edges1, outData.T, outCount.T * */ __pyx_t_113 = __pyx_v_i; __pyx_t_114 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9splitBBox_DTYPE_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_113, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_outMerge.diminfo[1].strides) = __pyx_v_dummy; } __pyx_L51:; } } } /* "splitBBox.pyx":263 * cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1)) * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 */ /*finally:*/ { Py_BLOCK_THREADS } } /* "splitBBox.pyx":373 * else: * outMerge[i, j] = dummy * return outMerge.T, edges0, edges1, outData.T, outCount.T # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_19 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __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_INCREF(((PyObject *)__pyx_v_edges0)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0)); __Pyx_INCREF(((PyObject *)__pyx_v_edges1)); PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1)); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_19); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_19 = 0; __pyx_r = ((PyObject *)__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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_19); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_inf.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdelta_pos0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_sup.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_inf.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cdata); __Pyx_XDECREF((PyObject *)__pyx_v_cpos0); __Pyx_XDECREF((PyObject *)__pyx_v_cdelta_pos0); __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_inf); __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_sup); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1); __Pyx_XDECREF((PyObject *)__pyx_v_cdelta_pos1); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_inf); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_sup); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_edges0); __Pyx_XDECREF((PyObject *)__pyx_v_edges1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":190 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":196 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":199 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":200 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":202 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":204 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":205 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L6; } /*else*/ { /* "numpy.pxd":207 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L6:; /* "numpy.pxd":209 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":210 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":213 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":218 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":219 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":222 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":223 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":224 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":225 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); /* "numpy.pxd":226 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } goto __pyx_L9; } /*else*/ { /* "numpy.pxd":228 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":229 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } __pyx_L9:; /* "numpy.pxd":230 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":231 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":232 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":235 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":236 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; /* "numpy.pxd":240 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":242 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":244 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L12; } /*else*/ { /* "numpy.pxd":247 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L12:; /* "numpy.pxd":249 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":250 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; /* "numpy.pxd":251 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":252 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "numpy.pxd":254 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L15; } /* "numpy.pxd":255 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L15; } /* "numpy.pxd":256 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L15; } /* "numpy.pxd":257 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L15; } /* "numpy.pxd":258 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L15; } /* "numpy.pxd":259 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L15; } /* "numpy.pxd":260 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L15; } /* "numpy.pxd":261 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L15; } /* "numpy.pxd":262 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L15; } /* "numpy.pxd":263 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L15; } /* "numpy.pxd":264 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L15; } /* "numpy.pxd":265 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L15; } /* "numpy.pxd":266 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L15; } /* "numpy.pxd":267 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L15; } /* "numpy.pxd":268 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L15; } /* "numpy.pxd":269 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L15; } /* "numpy.pxd":270 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L15; } /*else*/ { /* "numpy.pxd":272 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L15:; /* "numpy.pxd":273 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":274 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = '^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":277 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":278 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":281 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":282 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = 0; } __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":284 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); /* "numpy.pxd":285 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { /* "numpy.pxd":286 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":287 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":288 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L6; } __pyx_L6:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":764 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); /* "numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":767 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":770 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":773 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":776 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":779 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); /* "numpy.pxd":786 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":787 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":790 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":791 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":792 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":794 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":797 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; } else { __pyx_t_7 = __pyx_t_6; } if (!__pyx_t_7) { /* "numpy.pxd":798 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { __pyx_t_8 = (!__pyx_v_little_endian); __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":809 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; /* "numpy.pxd":810 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":811 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":812 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } /* "numpy.pxd":814 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); /* "numpy.pxd":816 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { /* "numpy.pxd":817 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":818 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "numpy.pxd":822 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } /* "numpy.pxd":823 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } /* "numpy.pxd":824 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } /* "numpy.pxd":825 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } /* "numpy.pxd":826 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } /* "numpy.pxd":827 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } /* "numpy.pxd":828 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } /* "numpy.pxd":829 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } /* "numpy.pxd":830 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } /* "numpy.pxd":831 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } /* "numpy.pxd":832 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } /* "numpy.pxd":833 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } /* "numpy.pxd":834 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } /* "numpy.pxd":835 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":836 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":837 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":838 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":840 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; /* "numpy.pxd":841 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { /* "numpy.pxd":845 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_11; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":846 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":961 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); /* "numpy.pxd":963 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":964 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":966 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":967 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":968 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":969 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); /* "numpy.pxd":972 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":973 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":975 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("splitBBox"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1}, {&__pyx_n_s__bin0_max, __pyx_k__bin0_max, sizeof(__pyx_k__bin0_max), 0, 0, 1, 1}, {&__pyx_n_s__bin0_min, __pyx_k__bin0_min, sizeof(__pyx_k__bin0_min), 0, 0, 1, 1}, {&__pyx_n_s__bin1_max, __pyx_k__bin1_max, sizeof(__pyx_k__bin1_max), 0, 0, 1, 1}, {&__pyx_n_s__bin1_min, __pyx_k__bin1_min, sizeof(__pyx_k__bin1_min), 0, 0, 1, 1}, {&__pyx_n_s__bins, __pyx_k__bins, sizeof(__pyx_k__bins), 0, 0, 1, 1}, {&__pyx_n_s__bins0, __pyx_k__bins0, sizeof(__pyx_k__bins0), 0, 0, 1, 1}, {&__pyx_n_s__bins1, __pyx_k__bins1, sizeof(__pyx_k__bins1), 0, 0, 1, 1}, {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1}, {&__pyx_n_s__cdelta_pos0, __pyx_k__cdelta_pos0, sizeof(__pyx_k__cdelta_pos0), 0, 0, 1, 1}, {&__pyx_n_s__cdelta_pos1, __pyx_k__cdelta_pos1, sizeof(__pyx_k__cdelta_pos1), 0, 0, 1, 1}, {&__pyx_n_s__checkpos1, __pyx_k__checkpos1, sizeof(__pyx_k__checkpos1), 0, 0, 1, 1}, {&__pyx_n_s__cpos0, __pyx_k__cpos0, sizeof(__pyx_k__cpos0), 0, 0, 1, 1}, {&__pyx_n_s__cpos0_inf, __pyx_k__cpos0_inf, sizeof(__pyx_k__cpos0_inf), 0, 0, 1, 1}, {&__pyx_n_s__cpos0_sup, __pyx_k__cpos0_sup, sizeof(__pyx_k__cpos0_sup), 0, 0, 1, 1}, {&__pyx_n_s__cpos1, __pyx_k__cpos1, sizeof(__pyx_k__cpos1), 0, 0, 1, 1}, {&__pyx_n_s__cpos1_inf, __pyx_k__cpos1_inf, sizeof(__pyx_k__cpos1_inf), 0, 0, 1, 1}, {&__pyx_n_s__cpos1_sup, __pyx_k__cpos1_sup, sizeof(__pyx_k__cpos1_sup), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__deltaA, __pyx_k__deltaA, sizeof(__pyx_k__deltaA), 0, 0, 1, 1}, {&__pyx_n_s__deltaD, __pyx_k__deltaD, sizeof(__pyx_k__deltaD), 0, 0, 1, 1}, {&__pyx_n_s__deltaL, __pyx_k__deltaL, sizeof(__pyx_k__deltaL), 0, 0, 1, 1}, {&__pyx_n_s__deltaR, __pyx_k__deltaR, sizeof(__pyx_k__deltaR), 0, 0, 1, 1}, {&__pyx_n_s__deltaU, __pyx_k__deltaU, sizeof(__pyx_k__deltaU), 0, 0, 1, 1}, {&__pyx_n_s__delta_pos0, __pyx_k__delta_pos0, sizeof(__pyx_k__delta_pos0), 0, 0, 1, 1}, {&__pyx_n_s__delta_pos1, __pyx_k__delta_pos1, sizeof(__pyx_k__delta_pos1), 0, 0, 1, 1}, {&__pyx_n_s__dpos, __pyx_k__dpos, sizeof(__pyx_k__dpos), 0, 0, 1, 1}, {&__pyx_n_s__dpos0, __pyx_k__dpos0, sizeof(__pyx_k__dpos0), 0, 0, 1, 1}, {&__pyx_n_s__dpos1, __pyx_k__dpos1, sizeof(__pyx_k__dpos1), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__dummy, __pyx_k__dummy, sizeof(__pyx_k__dummy), 0, 0, 1, 1}, {&__pyx_n_s__edges0, __pyx_k__edges0, sizeof(__pyx_k__edges0), 0, 0, 1, 1}, {&__pyx_n_s__edges1, __pyx_k__edges1, sizeof(__pyx_k__edges1), 0, 0, 1, 1}, {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1}, {&__pyx_n_s__epsilon, __pyx_k__epsilon, sizeof(__pyx_k__epsilon), 0, 0, 1, 1}, {&__pyx_n_s__fbin0_max, __pyx_k__fbin0_max, sizeof(__pyx_k__fbin0_max), 0, 0, 1, 1}, {&__pyx_n_s__fbin0_min, __pyx_k__fbin0_min, sizeof(__pyx_k__fbin0_min), 0, 0, 1, 1}, {&__pyx_n_s__fbin1_max, __pyx_k__fbin1_max, sizeof(__pyx_k__fbin1_max), 0, 0, 1, 1}, {&__pyx_n_s__fbin1_min, __pyx_k__fbin1_min, sizeof(__pyx_k__fbin1_min), 0, 0, 1, 1}, {&__pyx_n_s__finfo, __pyx_k__finfo, sizeof(__pyx_k__finfo), 0, 0, 1, 1}, {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, {&__pyx_n_s__histoBBox1d, __pyx_k__histoBBox1d, sizeof(__pyx_k__histoBBox1d), 0, 0, 1, 1}, {&__pyx_n_s__histoBBox2d, __pyx_k__histoBBox2d, sizeof(__pyx_k__histoBBox2d), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, {&__pyx_n_s__max0, __pyx_k__max0, sizeof(__pyx_k__max0), 0, 0, 1, 1}, {&__pyx_n_s__max1, __pyx_k__max1, sizeof(__pyx_k__max1), 0, 0, 1, 1}, {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, {&__pyx_n_s__min0, __pyx_k__min0, sizeof(__pyx_k__min0), 0, 0, 1, 1}, {&__pyx_n_s__min1, __pyx_k__min1, sizeof(__pyx_k__min1), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__outCount, __pyx_k__outCount, sizeof(__pyx_k__outCount), 0, 0, 1, 1}, {&__pyx_n_s__outData, __pyx_k__outData, sizeof(__pyx_k__outData), 0, 0, 1, 1}, {&__pyx_n_s__outMerge, __pyx_k__outMerge, sizeof(__pyx_k__outMerge), 0, 0, 1, 1}, {&__pyx_n_s__outPos, __pyx_k__outPos, sizeof(__pyx_k__outPos), 0, 0, 1, 1}, {&__pyx_n_s__pos0, __pyx_k__pos0, sizeof(__pyx_k__pos0), 0, 0, 1, 1}, {&__pyx_n_s__pos0Range, __pyx_k__pos0Range, sizeof(__pyx_k__pos0Range), 0, 0, 1, 1}, {&__pyx_n_s__pos0_max, __pyx_k__pos0_max, sizeof(__pyx_k__pos0_max), 0, 0, 1, 1}, {&__pyx_n_s__pos0_maxin, __pyx_k__pos0_maxin, sizeof(__pyx_k__pos0_maxin), 0, 0, 1, 1}, {&__pyx_n_s__pos0_min, __pyx_k__pos0_min, sizeof(__pyx_k__pos0_min), 0, 0, 1, 1}, {&__pyx_n_s__pos1, __pyx_k__pos1, sizeof(__pyx_k__pos1), 0, 0, 1, 1}, {&__pyx_n_s__pos1Range, __pyx_k__pos1Range, sizeof(__pyx_k__pos1Range), 0, 0, 1, 1}, {&__pyx_n_s__pos1_max, __pyx_k__pos1_max, sizeof(__pyx_k__pos1_max), 0, 0, 1, 1}, {&__pyx_n_s__pos1_maxin, __pyx_k__pos1_maxin, sizeof(__pyx_k__pos1_maxin), 0, 0, 1, 1}, {&__pyx_n_s__pos1_min, __pyx_k__pos1_min, sizeof(__pyx_k__pos1_min), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__ravel, __pyx_k__ravel, sizeof(__pyx_k__ravel), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__splitBBox, __pyx_k__splitBBox, sizeof(__pyx_k__splitBBox), 0, 0, 1, 1}, {&__pyx_n_s__tmp, __pyx_k__tmp, sizeof(__pyx_k__tmp), 0, 0, 1, 1}, {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "splitBBox.pyx":86 * assert bins > 1 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") */ __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); /* "splitBBox.pyx":87 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "splitBBox.pyx":88 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup */ __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "splitBBox.pyx":114 * assert delta_pos1.size == size * checkpos1 = 1 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") # <<<<<<<<<<<<<< * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") * pos1_min = min(pos1Range) */ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "splitBBox.pyx":115 * checkpos1 = 1 * cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32") * cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32") # <<<<<<<<<<<<<< * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); /* "splitBBox.pyx":184 * numpy.ndarray pos1 not None, * numpy.ndarray delta_pos1 not None, * bins=(100, 36), # <<<<<<<<<<<<<< * pos0Range=None, * pos1Range=None, */ __pyx_k_tuple_6 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(__pyx_int_100); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_100); __Pyx_GIVEREF(__pyx_int_100); __Pyx_INCREF(__pyx_int_36); PyTuple_SET_ITEM(__pyx_k_tuple_6, 1, __pyx_int_36); __Pyx_GIVEREF(__pyx_int_36); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "splitBBox.pyx":221 * if bins1 <= 0: * bins1 = 1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") */ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); /* "splitBBox.pyx":222 * bins1 = 1 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 */ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "splitBBox.pyx":223 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 */ __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); /* "splitBBox.pyx":226 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 */ __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "splitBBox.pyx":227 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32") * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1 * cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1 */ __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_23); __Pyx_INCREF(((PyObject *)__pyx_kp_u_22)); PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); /* "splitBBox.pyx":55 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox1d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ __pyx_k_tuple_24 = PyTuple_New(41); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 1, ((PyObject *)__pyx_n_s__pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 2, ((PyObject *)__pyx_n_s__delta_pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 3, ((PyObject *)__pyx_n_s__pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 4, ((PyObject *)__pyx_n_s__delta_pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 5, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 6, ((PyObject *)__pyx_n_s__pos0Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 7, ((PyObject *)__pyx_n_s__pos1Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 8, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 9, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 10, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_inf)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 11, ((PyObject *)__pyx_n_s__cpos0_inf)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_inf)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_sup)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 12, ((PyObject *)__pyx_n_s__cpos0_sup)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_sup)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_inf)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 13, ((PyObject *)__pyx_n_s__cpos1_inf)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_inf)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_sup)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 14, ((PyObject *)__pyx_n_s__cpos1_sup)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_sup)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 15, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 16, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 17, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 18, ((PyObject *)__pyx_n_s__outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 19, ((PyObject *)__pyx_n_s__deltaR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 20, ((PyObject *)__pyx_n_s__deltaL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 21, ((PyObject *)__pyx_n_s__deltaA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 22, ((PyObject *)__pyx_n_s__pos0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 23, ((PyObject *)__pyx_n_s__pos0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 24, ((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 25, ((PyObject *)__pyx_n_s__pos1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 26, ((PyObject *)__pyx_n_s__pos1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 27, ((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min0)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 28, ((PyObject *)__pyx_n_s__min0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max0)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 29, ((PyObject *)__pyx_n_s__max0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 30, ((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 31, ((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__checkpos1)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 32, ((PyObject *)__pyx_n_s__checkpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__checkpos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 33, ((PyObject *)__pyx_n_s__dpos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 34, ((PyObject *)__pyx_n_s__bin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 35, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 36, ((PyObject *)__pyx_n_s__idx)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 37, ((PyObject *)__pyx_n_s__bin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 38, ((PyObject *)__pyx_n_s__bin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 39, ((PyObject *)__pyx_n_s__epsilon)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 40, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(9, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__histoBBox1d, 55, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "splitBBox.pyx":179 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox2d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ __pyx_k_tuple_27 = PyTuple_New(57); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_27); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 2, ((PyObject *)__pyx_n_s__delta_pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 3, ((PyObject *)__pyx_n_s__pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 4, ((PyObject *)__pyx_n_s__delta_pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 5, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 6, ((PyObject *)__pyx_n_s__pos0Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 7, ((PyObject *)__pyx_n_s__pos1Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 8, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 9, ((PyObject *)__pyx_n_s__bins0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 10, ((PyObject *)__pyx_n_s__bins1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 11, ((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_27, 12, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 13, ((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_27, 14, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 15, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 16, ((PyObject *)__pyx_n_s__cpos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdelta_pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 17, ((PyObject *)__pyx_n_s__cdelta_pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdelta_pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_inf)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 18, ((PyObject *)__pyx_n_s__cpos0_inf)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_inf)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_sup)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 19, ((PyObject *)__pyx_n_s__cpos0_sup)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_sup)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 20, ((PyObject *)__pyx_n_s__cpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdelta_pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 21, ((PyObject *)__pyx_n_s__cdelta_pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdelta_pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_inf)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 22, ((PyObject *)__pyx_n_s__cpos1_inf)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_inf)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1_sup)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 23, ((PyObject *)__pyx_n_s__cpos1_sup)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1_sup)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 24, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 25, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 26, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 27, ((PyObject *)__pyx_n_s__edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 28, ((PyObject *)__pyx_n_s__edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 29, ((PyObject *)__pyx_n_s__min0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 30, ((PyObject *)__pyx_n_s__max0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 31, ((PyObject *)__pyx_n_s__min1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 32, ((PyObject *)__pyx_n_s__max1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 33, ((PyObject *)__pyx_n_s__deltaR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 34, ((PyObject *)__pyx_n_s__deltaL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 35, ((PyObject *)__pyx_n_s__deltaU)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 36, ((PyObject *)__pyx_n_s__deltaD)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 37, ((PyObject *)__pyx_n_s__deltaA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 38, ((PyObject *)__pyx_n_s__tmp)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 39, ((PyObject *)__pyx_n_s__pos0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 40, ((PyObject *)__pyx_n_s__pos0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 41, ((PyObject *)__pyx_n_s__pos1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 42, ((PyObject *)__pyx_n_s__pos1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 43, ((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 44, ((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 45, ((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 46, ((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 47, ((PyObject *)__pyx_n_s__fbin1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 48, ((PyObject *)__pyx_n_s__fbin1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 49, ((PyObject *)__pyx_n_s__bin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 50, ((PyObject *)__pyx_n_s__bin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 51, ((PyObject *)__pyx_n_s__bin1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 52, ((PyObject *)__pyx_n_s__bin1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 53, ((PyObject *)__pyx_n_s__epsilon)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 54, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 55, ((PyObject *)__pyx_n_s__dpos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 56, ((PyObject *)__pyx_n_s__dpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); __pyx_k_codeobj_28 = (PyObject*)__Pyx_PyCode_New(9, 0, 57, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__histoBBox2d, 179, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_36 = PyInt_FromLong(36); if (unlikely(!__pyx_int_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initsplitBBox(void); /*proto*/ PyMODINIT_FUNC initsplitBBox(void) #else PyMODINIT_FUNC PyInit_splitBBox(void); /*proto*/ PyMODINIT_FUNC PyInit_splitBBox(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_splitBBox(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("splitBBox"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_splitBBox) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "splitBBox.pyx":30 * import cython * cimport numpy * import numpy # <<<<<<<<<<<<<< * * cdef extern from "math.h": */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":55 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox1d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_histoBBox1d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":179 * @cython.boundscheck(False) * @cython.wraparound(False) * def histoBBox2d(numpy.ndarray weights not None, # <<<<<<<<<<<<<< * numpy.ndarray pos0 not None, * numpy.ndarray delta_pos0 not None, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_1histoBBox2d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitBBox.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # -*- coding: utf8 -*- * # */ __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; /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init splitBBox", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init splitBBox"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'b': return "'char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset; if (ctx->enc_type == 0) return 0; group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } __Pyx_BufFmt_RaiseExpected(ctx); return -1; } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; --ctx->enc_count; /* Consume from buffer string */ /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; } break; case '}': /* end of substruct; either repeat or move on */ ++ts; return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; default: { int number = __Pyx_BufFmt_ParseNumber(&ts); if (number == -1) { /* First char was not a digit */ PyErr_Format(PyExc_ValueError, "Does not understand character buffer dtype format string ('%c')", *ts); return NULL; } ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static void __Pyx_RaiseBufferFallbackError(void) { PyErr_Format(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; PyErr_NormalizeException(&local_type, &local_value, &local_tb); if (unlikely(tstate->curexc_type)) goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif *type = local_type; *value = local_value; *tb = local_tb; Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); else { PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject* obj = view->obj; if (obj) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); Py_DECREF(obj); view->obj = NULL; } } #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pyfai-0.3.5/src/relabel.pyx0000644001611600065110000000410611706364415014750 0ustar kieffersoft __author__ = "Jerome Kieffer" __contact__ = "Jerome.kieffer@esrf.fr" __date__ = "20110923" __status__ = "stable" __license__ = "GPLv3+" import cython cimport numpy import numpy ctypedef numpy.int64_t DTYPE_int64_t ctypedef numpy.float64_t DTYPE_float64_t @cython.boundscheck(False) @cython.wraparound(False) def countThem(numpy.ndarray label not None, \ numpy.ndarray data not None, \ numpy.ndarray blured not None): """ @param label: 2D array containing labeled zones @param data: 2D array containing the raw data @param blured: 2D array containing the blured data @return: 2D arrays containing: * count pixels in labelled zone: label == index).sum() * max of data in that zone: data[label == index].max() * max of blured in that zone: blured[label == index].max() * data-blured where data is max. """ cdef int maxLabel = label.max() cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten() cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten() cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten() cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64) cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64) cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64) cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64) cdef long s , i, idx cdef double d, b s = < long > label.size assert s == cdata.size assert s == cblured.size for i in range(s): idx = < long > clabel[i] d = < double > cdata[i] b = < double > cblured[i] count[idx] += 1 if d > maxData[idx]: maxData[idx] = d maxDelta[idx] = d - b if b > maxBlured[idx]: maxBlured[idx] = b return count, maxData, maxBlured, maxDelta pyfai-0.3.5/src/histogram.c0000644001611600065110000144125711655233320014747 0ustar kieffersoft/* Generated by Cython 0.15.1+ on Sat Nov 5 14:14:56 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif /* new Py3.3 unicode representation (PEP 393) */ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) #define CYTHON_PEP393_ENABLED #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #else #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__histogram #define __PYX_HAVE_API__histogram #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "omp.h" #include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "histogram.pyx", "numpy.pxd", }; /* "numpy.pxd":719 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":720 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":721 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":722 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":726 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":727 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":728 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":729 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":733 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":734 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":743 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":744 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":745 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":747 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":748 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":749 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":751 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":752 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":754 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":755 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":756 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "histogram.pyx":63 * # every type in the numpy module there's a corresponding compile-time * # type with a _t-suffix. * ctypedef numpy.int64_t DTYPE_int64_t # <<<<<<<<<<<<<< * ctypedef numpy.float64_t DTYPE_float64_t * */ typedef __pyx_t_5numpy_int64_t __pyx_t_9histogram_DTYPE_int64_t; /* "histogram.pyx":64 * # type with a _t-suffix. * ctypedef numpy.int64_t DTYPE_int64_t * ctypedef numpy.float64_t DTYPE_float64_t # <<<<<<<<<<<<<< * * @cython.cdivision(True) */ typedef __pyx_t_5numpy_float64_t __pyx_t_9histogram_DTYPE_float64_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":758 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":759 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":760 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":762 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ /* Run-time type information about structs used with buffers */ struct __Pyx_StructField_; typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); } else { r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } return r; } #include void __pyx_init_nan(void); static float __PYX_NAN; #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif Py_ssize_t __Pyx_zeros[] = {0, 0}; Py_ssize_t __Pyx_minusones[] = {-1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'histogram' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t = { "DTYPE_float64_t", NULL, sizeof(__pyx_t_9histogram_DTYPE_float64_t), 'R' }; #define __Pyx_MODULE_NAME "histogram" int __pyx_module_is_main_histogram = 0; /* Implementation of 'histogram' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_7[] = "ndarray is not C contiguous"; static char __pyx_k_9[] = "ndarray is not Fortran contiguous"; static char __pyx_k_11[] = "Non-native byte order not supported"; static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_17[] = "Format string allocated too short."; static char __pyx_k_21[] = "/home/jerome/workspace/azimuthal/pyFAI/src/histogram.pyx"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__a[] = "a"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__t[] = "t"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__b0[] = "b0"; static char __pyx_k__b1[] = "b1"; static char __pyx_k__p0[] = "p0"; static char __pyx_k__p1[] = "p1"; static char __pyx_k__bin[] = "bin"; static char __pyx_k__eps[] = "eps"; static char __pyx_k__idx[] = "idx"; static char __pyx_k__max[] = "max"; static char __pyx_k__min[] = "min"; static char __pyx_k__pos[] = "pos"; static char __pyx_k__aera[] = "aera"; static char __pyx_k__area[] = "area"; static char __pyx_k__bin0[] = "bin0"; static char __pyx_k__bin1[] = "bin1"; static char __pyx_k__bins[] = "bins"; static char __pyx_k__cpos[] = "cpos"; static char __pyx_k__dInt[] = "dInt"; static char __pyx_k__dTmp[] = "dTmp"; static char __pyx_k__data[] = "data"; static char __pyx_k__dbin[] = "dbin"; static char __pyx_k__dest[] = "dest"; static char __pyx_k__dtmp[] = "dtmp"; static char __pyx_k__fbin[] = "fbin"; static char __pyx_k__idp0[] = "idp0"; static char __pyx_k__idp1[] = "idp1"; static char __pyx_k__max0[] = "max0"; static char __pyx_k__max1[] = "max1"; static char __pyx_k__min0[] = "min0"; static char __pyx_k__min1[] = "min1"; static char __pyx_k__pos0[] = "pos0"; static char __pyx_k__pos1[] = "pos1"; static char __pyx_k__rest[] = "rest"; static char __pyx_k__size[] = "size"; static char __pyx_k__temp[] = "temp"; static char __pyx_k__cdata[] = "cdata"; static char __pyx_k__cpos0[] = "cpos0"; static char __pyx_k__cpos1[] = "cpos1"; static char __pyx_k__dIntL[] = "dIntL"; static char __pyx_k__dIntR[] = "dIntR"; static char __pyx_k__dbin0[] = "dbin0"; static char __pyx_k__dbin1[] = "dbin1"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__dummy[] = "dummy"; static char __pyx_k__fbin0[] = "fbin0"; static char __pyx_k__fbin1[] = "fbin1"; static char __pyx_k__ffbin[] = "ffbin"; static char __pyx_k__finfo[] = "finfo"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__ravel[] = "ravel"; static char __pyx_k__split[] = "split"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__astype[] = "astype"; static char __pyx_k__csplit[] = "csplit"; static char __pyx_k__double[] = "double"; static char __pyx_k__edges0[] = "edges0"; static char __pyx_k__edges1[] = "edges1"; static char __pyx_k__outPos[] = "outPos"; static char __pyx_k__bigData[] = "bigData"; static char __pyx_k__delta0l[] = "delta0l"; static char __pyx_k__delta0r[] = "delta0r"; static char __pyx_k__delta1l[] = "delta1l"; static char __pyx_k__delta1r[] = "delta1r"; static char __pyx_k__epsilon[] = "epsilon"; static char __pyx_k__flatten[] = "flatten"; static char __pyx_k__float64[] = "float64"; static char __pyx_k__nthread[] = "nthread"; static char __pyx_k__outData[] = "outData"; static char __pyx_k__weights[] = "weights"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__bigCount[] = "bigCount"; static char __pyx_k__outCount[] = "outCount"; static char __pyx_k__outMerge[] = "outMerge"; static char __pyx_k__tmp_data[] = "tmp_data"; static char __pyx_k__bin_range[] = "bin_range"; static char __pyx_k__bin_width[] = "bin_width"; static char __pyx_k__histogram[] = "histogram"; static char __pyx_k__inv_dbin2[] = "inv_dbin2"; static char __pyx_k__tmp_count[] = "tmp_count"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__histogram2d[] = "histogram2d"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__bin_edge_max[] = "bin_edge_max"; static char __pyx_k__bin_edge_min[] = "bin_edge_min"; static char __pyx_k__inv_bin_width[] = "inv_bin_width"; static char __pyx_k__pixelSize_in_Pos[] = "pixelSize_in_Pos"; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_14; static PyObject *__pyx_kp_u_17; static PyObject *__pyx_kp_s_21; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__a; static PyObject *__pyx_n_s__aera; static PyObject *__pyx_n_s__area; static PyObject *__pyx_n_s__astype; static PyObject *__pyx_n_s__b0; static PyObject *__pyx_n_s__b1; static PyObject *__pyx_n_s__bigCount; static PyObject *__pyx_n_s__bigData; static PyObject *__pyx_n_s__bin; static PyObject *__pyx_n_s__bin0; static PyObject *__pyx_n_s__bin1; static PyObject *__pyx_n_s__bin_edge_max; static PyObject *__pyx_n_s__bin_edge_min; static PyObject *__pyx_n_s__bin_range; static PyObject *__pyx_n_s__bin_width; static PyObject *__pyx_n_s__bins; static PyObject *__pyx_n_s__cdata; static PyObject *__pyx_n_s__cpos; static PyObject *__pyx_n_s__cpos0; static PyObject *__pyx_n_s__cpos1; static PyObject *__pyx_n_s__csplit; static PyObject *__pyx_n_s__d; static PyObject *__pyx_n_s__dInt; static PyObject *__pyx_n_s__dIntL; static PyObject *__pyx_n_s__dIntR; static PyObject *__pyx_n_s__dTmp; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__dbin; static PyObject *__pyx_n_s__dbin0; static PyObject *__pyx_n_s__dbin1; static PyObject *__pyx_n_s__delta0l; static PyObject *__pyx_n_s__delta0r; static PyObject *__pyx_n_s__delta1l; static PyObject *__pyx_n_s__delta1r; static PyObject *__pyx_n_s__dest; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtmp; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__dummy; static PyObject *__pyx_n_s__edges0; static PyObject *__pyx_n_s__edges1; static PyObject *__pyx_n_s__eps; static PyObject *__pyx_n_s__epsilon; static PyObject *__pyx_n_s__fbin; static PyObject *__pyx_n_s__fbin0; static PyObject *__pyx_n_s__fbin1; static PyObject *__pyx_n_s__ffbin; static PyObject *__pyx_n_s__finfo; static PyObject *__pyx_n_s__flatten; static PyObject *__pyx_n_s__float64; static PyObject *__pyx_n_s__histogram; static PyObject *__pyx_n_s__histogram2d; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__idp0; static PyObject *__pyx_n_s__idp1; static PyObject *__pyx_n_s__idx; static PyObject *__pyx_n_s__inv_bin_width; static PyObject *__pyx_n_s__inv_dbin2; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__max; static PyObject *__pyx_n_s__max0; static PyObject *__pyx_n_s__max1; static PyObject *__pyx_n_s__min; static PyObject *__pyx_n_s__min0; static PyObject *__pyx_n_s__min1; static PyObject *__pyx_n_s__nthread; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__outCount; static PyObject *__pyx_n_s__outData; static PyObject *__pyx_n_s__outMerge; static PyObject *__pyx_n_s__outPos; static PyObject *__pyx_n_s__p0; static PyObject *__pyx_n_s__p1; static PyObject *__pyx_n_s__pixelSize_in_Pos; static PyObject *__pyx_n_s__pos; static PyObject *__pyx_n_s__pos0; static PyObject *__pyx_n_s__pos1; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__ravel; static PyObject *__pyx_n_s__rest; static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__split; static PyObject *__pyx_n_s__t; static PyObject *__pyx_n_s__temp; static PyObject *__pyx_n_s__tmp_count; static PyObject *__pyx_n_s__tmp_data; static PyObject *__pyx_n_s__weights; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; static PyObject *__pyx_k_3; static PyObject *__pyx_k_tuple_1; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_18; static PyObject *__pyx_k_tuple_19; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_codeobj_20; static PyObject *__pyx_k_codeobj_23; /* "histogram.pyx":69 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram(numpy.ndarray pos not None, \ # <<<<<<<<<<<<<< * numpy.ndarray weights not None, \ * long bins=100, */ static PyObject *__pyx_pf_9histogram_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9histogram_histogram[] = "\n Calculates histogram of pos weighted by weights\n \n @param pos: 2Theta array\n @param weights: array with intensities\n @param bins: number of output bins\n @param pixelSize_in_Pos: size of a pixels in 2theta\n @param nthread: maximum number of thread to use. By default: maximum available. \n One can also limit this with OMP_NUM_THREADS environment variable\n \n @return 2theta, I, weighted histogram, raw histogram\n "; static PyMethodDef __pyx_mdef_9histogram_histogram = {__Pyx_NAMESTR("histogram"), (PyCFunction)__pyx_pf_9histogram_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9histogram_histogram)}; static PyObject *__pyx_pf_9histogram_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_pos = 0; PyArrayObject *__pyx_v_weights = 0; long __pyx_v_bins; PyObject *__pyx_v_bin_range = 0; PyObject *__pyx_v_pixelSize_in_Pos = 0; PyObject *__pyx_v_nthread = 0; double __pyx_v_dummy; long __pyx_v_size; PyArrayObject *__pyx_v_cpos = 0; PyArrayObject *__pyx_v_cdata = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_outPos = 0; CYTHON_UNUSED PyArrayObject *__pyx_v_temp = 0; double __pyx_v_bin_edge_min; double __pyx_v_bin_edge_max; double __pyx_v_bin_width; double __pyx_v_inv_bin_width; double __pyx_v_a; double __pyx_v_d; double __pyx_v_fbin; double __pyx_v_ffbin; double __pyx_v_dInt; double __pyx_v_dIntR; double __pyx_v_dIntL; CYTHON_UNUSED double __pyx_v_dTmp; double __pyx_v_dbin; double __pyx_v_inv_dbin2; double __pyx_v_tmp_count; double __pyx_v_tmp_data; double __pyx_v_epsilon; long __pyx_v_bin; long __pyx_v_i; long __pyx_v_idx; long __pyx_v_t; long __pyx_v_dest; double *__pyx_v_bigCount; double *__pyx_v_bigData; double __pyx_v_dtmp; Py_buffer __pyx_bstruct_outPos; Py_ssize_t __pyx_bstride_0_outPos = 0; Py_ssize_t __pyx_bshape_0_outPos = 0; Py_buffer __pyx_bstruct_outMerge; Py_ssize_t __pyx_bstride_0_outMerge = 0; Py_ssize_t __pyx_bshape_0_outMerge = 0; Py_buffer __pyx_bstruct_outCount; Py_ssize_t __pyx_bstride_0_outCount = 0; Py_ssize_t __pyx_bshape_0_outCount = 0; Py_buffer __pyx_bstruct_cdata; Py_ssize_t __pyx_bstride_0_cdata = 0; Py_ssize_t __pyx_bshape_0_cdata = 0; Py_buffer __pyx_bstruct_cpos; Py_ssize_t __pyx_bstride_0_cpos = 0; Py_ssize_t __pyx_bshape_0_cpos = 0; Py_buffer __pyx_bstruct_temp; Py_ssize_t __pyx_bstride_0_temp = 0; Py_ssize_t __pyx_bshape_0_temp = 0; Py_buffer __pyx_bstruct_outData; Py_ssize_t __pyx_bstride_0_outData = 0; Py_ssize_t __pyx_bshape_0_outData = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; long __pyx_t_5; PyArrayObject *__pyx_t_6 = NULL; PyArrayObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; PyArrayObject *__pyx_t_12 = NULL; PyArrayObject *__pyx_t_13 = NULL; double __pyx_t_14; int __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; long __pyx_t_19; long __pyx_t_20; long __pyx_t_21; long __pyx_t_22; long __pyx_t_23; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__bin_range,&__pyx_n_s__pixelSize_in_Pos,&__pyx_n_s__nthread,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("histogram"); __pyx_self = __pyx_self; { PyObject* values[7] = {0,0,0,0,0,0,0}; /* "histogram.pyx":72 * numpy.ndarray weights not None, \ * long bins=100, * bin_range=None, # <<<<<<<<<<<<<< * pixelSize_in_Pos=None, * nthread=None, */ values[3] = ((PyObject *)Py_None); /* "histogram.pyx":73 * long bins=100, * bin_range=None, * pixelSize_in_Pos=None, # <<<<<<<<<<<<<< * nthread=None, * double dummy=0.0): */ values[4] = ((PyObject *)Py_None); /* "histogram.pyx":74 * bin_range=None, * pixelSize_in_Pos=None, * nthread=None, # <<<<<<<<<<<<<< * double dummy=0.0): * """ */ values[5] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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 (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histogram", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bin_range); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pixelSize_in_Pos); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nthread); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[6] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { 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); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pos = ((PyArrayObject *)values[0]); __pyx_v_weights = ((PyArrayObject *)values[1]); if (values[2]) { __pyx_v_bins = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_bins = ((long)100); } __pyx_v_bin_range = values[3]; __pyx_v_pixelSize_in_Pos = values[4]; __pyx_v_nthread = values[5]; if (values[6]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "histogram.pyx":75 * pixelSize_in_Pos=None, * nthread=None, * double dummy=0.0): # <<<<<<<<<<<<<< * """ * Calculates histogram of pos weighted by weights */ __pyx_v_dummy = ((double)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("histogram", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("histogram.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_cpos.buf = NULL; __pyx_bstruct_cdata.buf = NULL; __pyx_bstruct_outData.buf = NULL; __pyx_bstruct_outCount.buf = NULL; __pyx_bstruct_outMerge.buf = NULL; __pyx_bstruct_outPos.buf = NULL; __pyx_bstruct_temp.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "histogram.pyx":89 * """ * * assert pos.size == weights.size # <<<<<<<<<<<<<< * assert bins > 1 * cdef long size = pos.size */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "histogram.pyx":90 * * assert pos.size == weights.size * assert bins > 1 # <<<<<<<<<<<<<< * cdef long size = pos.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_bins > 1))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "histogram.pyx":91 * assert pos.size == weights.size * assert bins > 1 * cdef long size = pos.size # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_size = __pyx_t_5; /* "histogram.pyx":92 * assert bins > 1 * cdef long size = pos.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0]; __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0]; } } __pyx_t_6 = 0; __pyx_v_cpos = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "histogram.pyx":93 * cdef long size = pos.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") */ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __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_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0]; __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0]; } } __pyx_t_7 = 0; __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":94 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; } } __pyx_t_9 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "histogram.pyx":95 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; } } __pyx_t_10 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "histogram.pyx":96 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64") */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; } } __pyx_t_11 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":97 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64") * cdef double bin_edge_min = pos.min() */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outPos, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outPos.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outPos = __pyx_bstruct_outPos.strides[0]; __pyx_bshape_0_outPos = __pyx_bstruct_outPos.shape[0]; } } __pyx_t_12 = 0; __pyx_v_outPos = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "histogram.pyx":98 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64") # <<<<<<<<<<<<<< * cdef double bin_edge_min = pos.min() * cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyInt_FromLong((__pyx_v_size - 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_temp.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_temp = __pyx_bstruct_temp.strides[0]; __pyx_bshape_0_temp = __pyx_bstruct_temp.shape[0]; } } __pyx_t_13 = 0; __pyx_v_temp = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "histogram.pyx":99 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64") * cdef double bin_edge_min = pos.min() # <<<<<<<<<<<<<< * cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps) * if bin_range is not None: */ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_bin_edge_min = __pyx_t_14; /* "histogram.pyx":100 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64") * cdef double bin_edge_min = pos.min() * cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * if bin_range is not None: * bin_edge_min = bin_range[0] */ __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__max); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__double); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_bin_edge_max = __pyx_t_14; /* "histogram.pyx":101 * cdef double bin_edge_min = pos.min() * cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps) * if bin_range is not None: # <<<<<<<<<<<<<< * bin_edge_min = bin_range[0] * bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_4 = (__pyx_v_bin_range != Py_None); if (__pyx_t_4) { /* "histogram.pyx":102 * cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps) * if bin_range is not None: * bin_edge_min = bin_range[0] # <<<<<<<<<<<<<< * bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps) * cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins)) */ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_bin_range, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_bin_edge_min = __pyx_t_14; /* "histogram.pyx":103 * if bin_range is not None: * bin_edge_min = bin_range[0] * bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins)) * cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min) */ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_bin_range, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_bin_edge_max = __pyx_t_14; goto __pyx_L6; } __pyx_L6:; /* "histogram.pyx":104 * bin_edge_min = bin_range[0] * bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps) * cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins)) # <<<<<<<<<<<<<< * cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min) * cdef double a = 0.0 */ __pyx_v_bin_width = ((__pyx_v_bin_edge_max - __pyx_v_bin_edge_min) / ((double)__pyx_v_bins)); /* "histogram.pyx":105 * bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps) * cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins)) * cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min) # <<<<<<<<<<<<<< * cdef double a = 0.0 * cdef double d = 0.0 */ __pyx_v_inv_bin_width = (((double)__pyx_v_bins) / (__pyx_v_bin_edge_max - __pyx_v_bin_edge_min)); /* "histogram.pyx":106 * cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins)) * cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min) * cdef double a = 0.0 # <<<<<<<<<<<<<< * cdef double d = 0.0 * cdef double fbin = 0.0 */ __pyx_v_a = 0.0; /* "histogram.pyx":107 * cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min) * cdef double a = 0.0 * cdef double d = 0.0 # <<<<<<<<<<<<<< * cdef double fbin = 0.0 * cdef double ffbin = 0.0 */ __pyx_v_d = 0.0; /* "histogram.pyx":108 * cdef double a = 0.0 * cdef double d = 0.0 * cdef double fbin = 0.0 # <<<<<<<<<<<<<< * cdef double ffbin = 0.0 * cdef double dInt = 0.0 */ __pyx_v_fbin = 0.0; /* "histogram.pyx":109 * cdef double d = 0.0 * cdef double fbin = 0.0 * cdef double ffbin = 0.0 # <<<<<<<<<<<<<< * cdef double dInt = 0.0 * cdef double dIntR = 0.0 */ __pyx_v_ffbin = 0.0; /* "histogram.pyx":110 * cdef double fbin = 0.0 * cdef double ffbin = 0.0 * cdef double dInt = 0.0 # <<<<<<<<<<<<<< * cdef double dIntR = 0.0 * cdef double dIntL = 0.0 */ __pyx_v_dInt = 0.0; /* "histogram.pyx":111 * cdef double ffbin = 0.0 * cdef double dInt = 0.0 * cdef double dIntR = 0.0 # <<<<<<<<<<<<<< * cdef double dIntL = 0.0 * cdef double dTmp = 0.0 */ __pyx_v_dIntR = 0.0; /* "histogram.pyx":112 * cdef double dInt = 0.0 * cdef double dIntR = 0.0 * cdef double dIntL = 0.0 # <<<<<<<<<<<<<< * cdef double dTmp = 0.0 * cdef double dbin, inv_dbin2 = 0.0 */ __pyx_v_dIntL = 0.0; /* "histogram.pyx":113 * cdef double dIntR = 0.0 * cdef double dIntL = 0.0 * cdef double dTmp = 0.0 # <<<<<<<<<<<<<< * cdef double dbin, inv_dbin2 = 0.0 * cdef double tmp_count, tmp_data = 0.0 */ __pyx_v_dTmp = 0.0; /* "histogram.pyx":114 * cdef double dIntL = 0.0 * cdef double dTmp = 0.0 * cdef double dbin, inv_dbin2 = 0.0 # <<<<<<<<<<<<<< * cdef double tmp_count, tmp_data = 0.0 * cdef double epsilon = 1e-10 */ __pyx_v_inv_dbin2 = 0.0; /* "histogram.pyx":115 * cdef double dTmp = 0.0 * cdef double dbin, inv_dbin2 = 0.0 * cdef double tmp_count, tmp_data = 0.0 # <<<<<<<<<<<<<< * cdef double epsilon = 1e-10 * */ __pyx_v_tmp_data = 0.0; /* "histogram.pyx":116 * cdef double dbin, inv_dbin2 = 0.0 * cdef double tmp_count, tmp_data = 0.0 * cdef double epsilon = 1e-10 # <<<<<<<<<<<<<< * * cdef long bin = 0 */ __pyx_v_epsilon = 1e-10; /* "histogram.pyx":118 * cdef double epsilon = 1e-10 * * cdef long bin = 0 # <<<<<<<<<<<<<< * cdef long i, idx, t, dest = 0 * if nthread is not None: */ __pyx_v_bin = 0; /* "histogram.pyx":119 * * cdef long bin = 0 * cdef long i, idx, t, dest = 0 # <<<<<<<<<<<<<< * if nthread is not None: * if isinstance(nthread, int) and (nthread > 0): */ __pyx_v_dest = 0; /* "histogram.pyx":120 * cdef long bin = 0 * cdef long i, idx, t, dest = 0 * if nthread is not None: # <<<<<<<<<<<<<< * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) */ __pyx_t_4 = (__pyx_v_nthread != Py_None); if (__pyx_t_4) { /* "histogram.pyx":121 * cdef long i, idx, t, dest = 0 * if nthread is not None: * if isinstance(nthread, int) and (nthread > 0): # <<<<<<<<<<<<<< * omp_set_num_threads(< int > nthread) * */ __pyx_t_3 = ((PyObject *)((PyObject*)(&PyInt_Type))); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_nthread, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = __pyx_t_15; } else { __pyx_t_16 = __pyx_t_4; } if (__pyx_t_16) { /* "histogram.pyx":122 * if nthread is not None: * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) # <<<<<<<<<<<<<< * * cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) */ __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_nthread); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} omp_set_num_threads(((int)__pyx_t_17)); goto __pyx_L8; } __pyx_L8:; goto __pyx_L7; } __pyx_L7:; /* "histogram.pyx":124 * omp_set_num_threads(< int > nthread) * * cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) # <<<<<<<<<<<<<< * cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) * if pixelSize_in_Pos is None: */ __pyx_v_bigCount = ((double *)calloc((__pyx_v_bins * omp_get_max_threads()), (sizeof(double)))); /* "histogram.pyx":125 * * cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) * cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) # <<<<<<<<<<<<<< * if pixelSize_in_Pos is None: * dbin = 0.5 */ __pyx_v_bigData = ((double *)calloc((__pyx_v_bins * omp_get_max_threads()), (sizeof(double)))); /* "histogram.pyx":126 * cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) * cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) * if pixelSize_in_Pos is None: # <<<<<<<<<<<<<< * dbin = 0.5 * inv_dbin2 = 4.0 */ __pyx_t_16 = (__pyx_v_pixelSize_in_Pos == Py_None); if (__pyx_t_16) { /* "histogram.pyx":127 * cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double)) * if pixelSize_in_Pos is None: * dbin = 0.5 # <<<<<<<<<<<<<< * inv_dbin2 = 4.0 * elif isinstance(pixelSize_in_Pos, (int, float)): */ __pyx_v_dbin = 0.5; /* "histogram.pyx":128 * if pixelSize_in_Pos is None: * dbin = 0.5 * inv_dbin2 = 4.0 # <<<<<<<<<<<<<< * elif isinstance(pixelSize_in_Pos, (int, float)): * dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width */ __pyx_v_inv_dbin2 = 4.0; goto __pyx_L9; } /* "histogram.pyx":129 * dbin = 0.5 * inv_dbin2 = 4.0 * elif isinstance(pixelSize_in_Pos, (int, float)): # <<<<<<<<<<<<<< * dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width * if dbin > 0.0: */ __Pyx_INCREF(__pyx_v_pixelSize_in_Pos); __pyx_t_3 = __pyx_v_pixelSize_in_Pos; __pyx_t_16 = PyInt_Check(__pyx_t_3); if (!__pyx_t_16) { __pyx_t_4 = PyFloat_Check(__pyx_t_3); __pyx_t_15 = __pyx_t_4; } else { __pyx_t_15 = __pyx_t_16; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_15) { /* "histogram.pyx":130 * inv_dbin2 = 4.0 * elif isinstance(pixelSize_in_Pos, (int, float)): * dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width # <<<<<<<<<<<<<< * if dbin > 0.0: * inv_dbin2 = 1 / dbin / dbin */ __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_pixelSize_in_Pos); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_dbin = ((0.5 * ((double)__pyx_t_14)) * __pyx_v_inv_bin_width); /* "histogram.pyx":131 * elif isinstance(pixelSize_in_Pos, (int, float)): * dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width * if dbin > 0.0: # <<<<<<<<<<<<<< * inv_dbin2 = 1 / dbin / dbin * else: */ __pyx_t_15 = (__pyx_v_dbin > 0.0); if (__pyx_t_15) { /* "histogram.pyx":132 * dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width * if dbin > 0.0: * inv_dbin2 = 1 / dbin / dbin # <<<<<<<<<<<<<< * else: * inv_dbin2 = 0.0 */ __pyx_v_inv_dbin2 = ((1.0 / __pyx_v_dbin) / __pyx_v_dbin); goto __pyx_L10; } /*else*/ { /* "histogram.pyx":134 * inv_dbin2 = 1 / dbin / dbin * else: * inv_dbin2 = 0.0 # <<<<<<<<<<<<<< * elif isinstance(pixelSize_in_Pos, numpy.ndarray): * pass #TODO */ __pyx_v_inv_dbin2 = 0.0; } __pyx_L10:; goto __pyx_L9; } /* "histogram.pyx":135 * else: * inv_dbin2 = 0.0 * elif isinstance(pixelSize_in_Pos, numpy.ndarray): # <<<<<<<<<<<<<< * pass #TODO * */ __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)); __Pyx_INCREF(__pyx_t_3); __pyx_t_15 = __Pyx_TypeCheck(__pyx_v_pixelSize_in_Pos, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_15) { goto __pyx_L9; } __pyx_L9:; /* "histogram.pyx":138 * pass #TODO * * if isnan(dbin) or isnan(inv_dbin2): # <<<<<<<<<<<<<< * dbin = 0.0 * inv_dbin2 = 0.0 */ __pyx_t_17 = isnan(__pyx_v_dbin); if (!__pyx_t_17) { __pyx_t_18 = isnan(__pyx_v_inv_dbin2); __pyx_t_15 = __pyx_t_18; } else { __pyx_t_15 = __pyx_t_17; } if (__pyx_t_15) { /* "histogram.pyx":139 * * if isnan(dbin) or isnan(inv_dbin2): * dbin = 0.0 # <<<<<<<<<<<<<< * inv_dbin2 = 0.0 * */ __pyx_v_dbin = 0.0; /* "histogram.pyx":140 * if isnan(dbin) or isnan(inv_dbin2): * dbin = 0.0 * inv_dbin2 = 0.0 # <<<<<<<<<<<<<< * * with nogil: */ __pyx_v_inv_dbin2 = 0.0; goto __pyx_L11; } __pyx_L11:; /* "histogram.pyx":142 * inv_dbin2 = 0.0 * * with nogil: # <<<<<<<<<<<<<< * for i in prange(size): * d = cdata[i] */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "histogram.pyx":143 * * with nogil: * for i in prange(size): # <<<<<<<<<<<<<< * d = cdata[i] * a = cpos[i] */ __pyx_t_5 = __pyx_v_size; if (1 == 0) abort(); { __pyx_t_20 = (__pyx_t_5 - 0) / 1; if (__pyx_t_20 > 0) { __pyx_v_i = 0; #ifdef _OPENMP #pragma omp parallel private(__pyx_t_23, __pyx_t_4, __pyx_t_16, __pyx_t_21, __pyx_t_15, __pyx_t_22) #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for lastprivate(__pyx_v_dest) lastprivate(__pyx_v_dIntL) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_dIntR) lastprivate(__pyx_v_bin) lastprivate(__pyx_v_dtmp) lastprivate(__pyx_v_a) lastprivate(__pyx_v_ffbin) lastprivate(__pyx_v_d) lastprivate(__pyx_v_fbin) lastprivate(__pyx_v_dInt) #endif /* _OPENMP */ for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_20; __pyx_t_19++){ { __pyx_v_i = 0 + 1 * __pyx_t_19; /* Initialize private variables to invalid values */ __pyx_v_dest = ((long)0xbad0bad0); __pyx_v_dIntL = ((double)__PYX_NAN); __pyx_v_dIntR = ((double)__PYX_NAN); __pyx_v_bin = ((long)0xbad0bad0); __pyx_v_dtmp = ((double)__PYX_NAN); __pyx_v_a = ((double)__PYX_NAN); __pyx_v_ffbin = ((double)__PYX_NAN); __pyx_v_d = ((double)__PYX_NAN); __pyx_v_fbin = ((double)__PYX_NAN); __pyx_v_dInt = ((double)__PYX_NAN); /* "histogram.pyx":144 * with nogil: * for i in prange(size): * d = cdata[i] # <<<<<<<<<<<<<< * a = cpos[i] * if (a < bin_edge_min) or (a > bin_edge_max): */ __pyx_t_21 = __pyx_v_i; __pyx_v_d = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_21, __pyx_bstride_0_cdata)); /* "histogram.pyx":145 * for i in prange(size): * d = cdata[i] * a = cpos[i] # <<<<<<<<<<<<<< * if (a < bin_edge_min) or (a > bin_edge_max): * continue */ __pyx_t_22 = __pyx_v_i; __pyx_v_a = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_22, __pyx_bstride_0_cpos)); /* "histogram.pyx":146 * d = cdata[i] * a = cpos[i] * if (a < bin_edge_min) or (a > bin_edge_max): # <<<<<<<<<<<<<< * continue * fbin = (a - bin_edge_min) * inv_bin_width */ __pyx_t_15 = (__pyx_v_a < __pyx_v_bin_edge_min); if (!__pyx_t_15) { __pyx_t_16 = (__pyx_v_a > __pyx_v_bin_edge_max); __pyx_t_4 = __pyx_t_16; } else { __pyx_t_4 = __pyx_t_15; } if (__pyx_t_4) { /* "histogram.pyx":147 * a = cpos[i] * if (a < bin_edge_min) or (a > bin_edge_max): * continue # <<<<<<<<<<<<<< * fbin = (a - bin_edge_min) * inv_bin_width * ffbin = floor(fbin) */ goto __pyx_L15_continue; goto __pyx_L19; } __pyx_L19:; /* "histogram.pyx":148 * if (a < bin_edge_min) or (a > bin_edge_max): * continue * fbin = (a - bin_edge_min) * inv_bin_width # <<<<<<<<<<<<<< * ffbin = floor(fbin) * bin = < long > ffbin */ __pyx_v_fbin = ((__pyx_v_a - __pyx_v_bin_edge_min) * __pyx_v_inv_bin_width); /* "histogram.pyx":149 * continue * fbin = (a - bin_edge_min) * inv_bin_width * ffbin = floor(fbin) # <<<<<<<<<<<<<< * bin = < long > ffbin * dest = omp_get_thread_num() * bins + bin */ __pyx_v_ffbin = floor(__pyx_v_fbin); /* "histogram.pyx":150 * fbin = (a - bin_edge_min) * inv_bin_width * ffbin = floor(fbin) * bin = < long > ffbin # <<<<<<<<<<<<<< * dest = omp_get_thread_num() * bins + bin * dInt = 1.0 */ __pyx_v_bin = ((long)__pyx_v_ffbin); /* "histogram.pyx":151 * ffbin = floor(fbin) * bin = < long > ffbin * dest = omp_get_thread_num() * bins + bin # <<<<<<<<<<<<<< * dInt = 1.0 * if bin > 0 : */ __pyx_v_dest = ((omp_get_thread_num() * __pyx_v_bins) + __pyx_v_bin); /* "histogram.pyx":152 * bin = < long > ffbin * dest = omp_get_thread_num() * bins + bin * dInt = 1.0 # <<<<<<<<<<<<<< * if bin > 0 : * dtmp = ffbin - (fbin - dbin) */ __pyx_v_dInt = 1.0; /* "histogram.pyx":153 * dest = omp_get_thread_num() * bins + bin * dInt = 1.0 * if bin > 0 : # <<<<<<<<<<<<<< * dtmp = ffbin - (fbin - dbin) * if dtmp > 0: */ __pyx_t_4 = (__pyx_v_bin > 0); if (__pyx_t_4) { /* "histogram.pyx":154 * dInt = 1.0 * if bin > 0 : * dtmp = ffbin - (fbin - dbin) # <<<<<<<<<<<<<< * if dtmp > 0: * dIntL = 0.5 * dtmp * dtmp * inv_dbin2 */ __pyx_v_dtmp = (__pyx_v_ffbin - (__pyx_v_fbin - __pyx_v_dbin)); /* "histogram.pyx":155 * if bin > 0 : * dtmp = ffbin - (fbin - dbin) * if dtmp > 0: # <<<<<<<<<<<<<< * dIntL = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntL */ __pyx_t_4 = (__pyx_v_dtmp > 0.0); if (__pyx_t_4) { /* "histogram.pyx":156 * dtmp = ffbin - (fbin - dbin) * if dtmp > 0: * dIntL = 0.5 * dtmp * dtmp * inv_dbin2 # <<<<<<<<<<<<<< * dInt = dInt - dIntL * bigCount[dest - 1] += dIntL */ __pyx_v_dIntL = (((0.5 * __pyx_v_dtmp) * __pyx_v_dtmp) * __pyx_v_inv_dbin2); /* "histogram.pyx":157 * if dtmp > 0: * dIntL = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntL # <<<<<<<<<<<<<< * bigCount[dest - 1] += dIntL * bigData[dest - 1] += d * dIntL */ __pyx_v_dInt = (__pyx_v_dInt - __pyx_v_dIntL); /* "histogram.pyx":158 * dIntL = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntL * bigCount[dest - 1] += dIntL # <<<<<<<<<<<<<< * bigData[dest - 1] += d * dIntL * */ __pyx_t_23 = (__pyx_v_dest - 1); (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dIntL); /* "histogram.pyx":159 * dInt = dInt - dIntL * bigCount[dest - 1] += dIntL * bigData[dest - 1] += d * dIntL # <<<<<<<<<<<<<< * * if bin < bins - 1 : */ __pyx_t_23 = (__pyx_v_dest - 1); (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dIntL)); goto __pyx_L21; } __pyx_L21:; goto __pyx_L20; } __pyx_L20:; /* "histogram.pyx":161 * bigData[dest - 1] += d * dIntL * * if bin < bins - 1 : # <<<<<<<<<<<<<< * dtmp = fbin + dbin - ffbin - 1 * if dtmp > 0 : */ __pyx_t_4 = (__pyx_v_bin < (__pyx_v_bins - 1)); if (__pyx_t_4) { /* "histogram.pyx":162 * * if bin < bins - 1 : * dtmp = fbin + dbin - ffbin - 1 # <<<<<<<<<<<<<< * if dtmp > 0 : * dIntR = 0.5 * dtmp * dtmp * inv_dbin2 */ __pyx_v_dtmp = (((__pyx_v_fbin + __pyx_v_dbin) - __pyx_v_ffbin) - 1.0); /* "histogram.pyx":163 * if bin < bins - 1 : * dtmp = fbin + dbin - ffbin - 1 * if dtmp > 0 : # <<<<<<<<<<<<<< * dIntR = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntR */ __pyx_t_4 = (__pyx_v_dtmp > 0.0); if (__pyx_t_4) { /* "histogram.pyx":164 * dtmp = fbin + dbin - ffbin - 1 * if dtmp > 0 : * dIntR = 0.5 * dtmp * dtmp * inv_dbin2 # <<<<<<<<<<<<<< * dInt = dInt - dIntR * bigCount[dest + 1] += dIntR */ __pyx_v_dIntR = (((0.5 * __pyx_v_dtmp) * __pyx_v_dtmp) * __pyx_v_inv_dbin2); /* "histogram.pyx":165 * if dtmp > 0 : * dIntR = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntR # <<<<<<<<<<<<<< * bigCount[dest + 1] += dIntR * bigData[dest + 1] += d * dIntR */ __pyx_v_dInt = (__pyx_v_dInt - __pyx_v_dIntR); /* "histogram.pyx":166 * dIntR = 0.5 * dtmp * dtmp * inv_dbin2 * dInt = dInt - dIntR * bigCount[dest + 1] += dIntR # <<<<<<<<<<<<<< * bigData[dest + 1] += d * dIntR * bigCount[dest] += dInt */ __pyx_t_23 = (__pyx_v_dest + 1); (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dIntR); /* "histogram.pyx":167 * dInt = dInt - dIntR * bigCount[dest + 1] += dIntR * bigData[dest + 1] += d * dIntR # <<<<<<<<<<<<<< * bigCount[dest] += dInt * bigData[dest] += d * dInt */ __pyx_t_23 = (__pyx_v_dest + 1); (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dIntR)); goto __pyx_L23; } __pyx_L23:; goto __pyx_L22; } __pyx_L22:; /* "histogram.pyx":168 * bigCount[dest + 1] += dIntR * bigData[dest + 1] += d * dIntR * bigCount[dest] += dInt # <<<<<<<<<<<<<< * bigData[dest] += d * dInt * */ __pyx_t_23 = __pyx_v_dest; (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dInt); /* "histogram.pyx":169 * bigData[dest + 1] += d * dIntR * bigCount[dest] += dInt * bigData[dest] += d * dInt # <<<<<<<<<<<<<< * * for idx in prange(bins): */ __pyx_t_23 = __pyx_v_dest; (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dInt)); goto __pyx_L25; __pyx_L15_continue:; goto __pyx_L25; __pyx_L25:; } } } } } /* "histogram.pyx":171 * bigData[dest] += d * dInt * * for idx in prange(bins): # <<<<<<<<<<<<<< * outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width * tmp_count = 0.0 */ __pyx_t_20 = __pyx_v_bins; if (1 == 0) abort(); { __pyx_t_5 = (__pyx_t_20 - 0) / 1; if (__pyx_t_5 > 0) { __pyx_v_idx = 0; #ifdef _OPENMP #pragma omp parallel reduction(+:__pyx_v_tmp_count) reduction(+:__pyx_v_tmp_data) private(__pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_23, __pyx_t_17, __pyx_t_4, __pyx_t_24, __pyx_t_25) #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for lastprivate(__pyx_v_t) firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_dest) #endif /* _OPENMP */ for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_5; __pyx_t_19++){ { __pyx_v_idx = 0 + 1 * __pyx_t_19; /* Initialize private variables to invalid values */ __pyx_v_t = ((long)0xbad0bad0); __pyx_v_dest = ((long)0xbad0bad0); /* "histogram.pyx":172 * * for idx in prange(bins): * outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width # <<<<<<<<<<<<<< * tmp_count = 0.0 * tmp_data = 0.0 */ __pyx_t_23 = __pyx_v_idx; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outPos.buf, __pyx_t_23, __pyx_bstride_0_outPos) = (__pyx_v_bin_edge_min + ((0.5 + ((double)__pyx_v_idx)) * __pyx_v_bin_width)); /* "histogram.pyx":173 * for idx in prange(bins): * outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width * tmp_count = 0.0 # <<<<<<<<<<<<<< * tmp_data = 0.0 * for t in range(omp_get_max_threads()): */ __pyx_v_tmp_count = 0.0; /* "histogram.pyx":174 * outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width * tmp_count = 0.0 * tmp_data = 0.0 # <<<<<<<<<<<<<< * for t in range(omp_get_max_threads()): * dest = t * bins + idx */ __pyx_v_tmp_data = 0.0; /* "histogram.pyx":175 * tmp_count = 0.0 * tmp_data = 0.0 * for t in range(omp_get_max_threads()): # <<<<<<<<<<<<<< * dest = t * bins + idx * tmp_count += bigCount[dest] */ __pyx_t_17 = omp_get_max_threads(); for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_17; __pyx_t_24+=1) { __pyx_v_t = __pyx_t_24; /* "histogram.pyx":176 * tmp_data = 0.0 * for t in range(omp_get_max_threads()): * dest = t * bins + idx # <<<<<<<<<<<<<< * tmp_count += bigCount[dest] * tmp_data += bigData[dest] */ __pyx_v_dest = ((__pyx_v_t * __pyx_v_bins) + __pyx_v_idx); /* "histogram.pyx":177 * for t in range(omp_get_max_threads()): * dest = t * bins + idx * tmp_count += bigCount[dest] # <<<<<<<<<<<<<< * tmp_data += bigData[dest] * outCount[idx] += tmp_count */ __pyx_v_tmp_count = (__pyx_v_tmp_count + (__pyx_v_bigCount[__pyx_v_dest])); /* "histogram.pyx":178 * dest = t * bins + idx * tmp_count += bigCount[dest] * tmp_data += bigData[dest] # <<<<<<<<<<<<<< * outCount[idx] += tmp_count * outData[idx] += tmp_data */ __pyx_v_tmp_data = (__pyx_v_tmp_data + (__pyx_v_bigData[__pyx_v_dest])); } /* "histogram.pyx":179 * tmp_count += bigCount[dest] * tmp_data += bigData[dest] * outCount[idx] += tmp_count # <<<<<<<<<<<<<< * outData[idx] += tmp_data * if outCount[idx] > epsilon: */ __pyx_t_24 = __pyx_v_idx; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_24, __pyx_bstride_0_outCount) += __pyx_v_tmp_count; /* "histogram.pyx":180 * tmp_data += bigData[dest] * outCount[idx] += tmp_count * outData[idx] += tmp_data # <<<<<<<<<<<<<< * if outCount[idx] > epsilon: * outMerge[idx] += tmp_data / tmp_count */ __pyx_t_25 = __pyx_v_idx; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_25, __pyx_bstride_0_outData) += __pyx_v_tmp_data; /* "histogram.pyx":181 * outCount[idx] += tmp_count * outData[idx] += tmp_data * if outCount[idx] > epsilon: # <<<<<<<<<<<<<< * outMerge[idx] += tmp_data / tmp_count * else: */ __pyx_t_26 = __pyx_v_idx; __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_26, __pyx_bstride_0_outCount)) > __pyx_v_epsilon); if (__pyx_t_4) { /* "histogram.pyx":182 * outData[idx] += tmp_data * if outCount[idx] > epsilon: * outMerge[idx] += tmp_data / tmp_count # <<<<<<<<<<<<<< * else: * outMerge[idx] += dummy */ __pyx_t_27 = __pyx_v_idx; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_27, __pyx_bstride_0_outMerge) += (__pyx_v_tmp_data / __pyx_v_tmp_count); goto __pyx_L32; } /*else*/ { /* "histogram.pyx":184 * outMerge[idx] += tmp_data / tmp_count * else: * outMerge[idx] += dummy # <<<<<<<<<<<<<< * * free(bigCount) */ __pyx_t_28 = __pyx_v_idx; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_28, __pyx_bstride_0_outMerge) += __pyx_v_dummy; } __pyx_L32:; } } } } } } /* "histogram.pyx":142 * inv_dbin2 = 0.0 * * with nogil: # <<<<<<<<<<<<<< * for i in prange(size): * d = cdata[i] */ /*finally:*/ { Py_BLOCK_THREADS } } /* "histogram.pyx":186 * outMerge[idx] += dummy * * free(bigCount) # <<<<<<<<<<<<<< * free(bigData) * return outPos, outMerge, outData, outCount */ free(__pyx_v_bigCount); /* "histogram.pyx":187 * * free(bigCount) * free(bigData) # <<<<<<<<<<<<<< * return outPos, outMerge, outData, outCount * */ free(__pyx_v_bigData); /* "histogram.pyx":188 * free(bigCount) * free(bigData) * return outPos, outMerge, outData, outCount # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_outPos)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos)); __Pyx_INCREF(((PyObject *)__pyx_v_outMerge)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge)); __Pyx_INCREF(((PyObject *)__pyx_v_outData)); PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_outData)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outData)); __Pyx_INCREF(((PyObject *)__pyx_v_outCount)); PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount)); __pyx_r = ((PyObject *)__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_8); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("histogram.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cpos); __Pyx_XDECREF((PyObject *)__pyx_v_cdata); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_outPos); __Pyx_XDECREF((PyObject *)__pyx_v_temp); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "histogram.pyx":194 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram2d(numpy.ndarray pos0 not None, # <<<<<<<<<<<<<< * numpy.ndarray pos1 not None, * bins not None, */ static PyObject *__pyx_pf_9histogram_1histogram2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9histogram_1histogram2d[] = "\n Calculate 2D histogram of pos0,pos1 weighted by weights\n\n @param pos0: 2Theta array\n @param pos1: Chi array\n @param weights: array with intensities\n @param bins: number of output bins int or 2-tuple of int\n @param nthread: maximum number of thread to use. By default: maximum available. \n One can also limit this with OMP_NUM_THREADS environment variable\n\n \n @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n "; static PyMethodDef __pyx_mdef_9histogram_1histogram2d = {__Pyx_NAMESTR("histogram2d"), (PyCFunction)__pyx_pf_9histogram_1histogram2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9histogram_1histogram2d)}; static PyObject *__pyx_pf_9histogram_1histogram2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_pos0 = 0; PyArrayObject *__pyx_v_pos1 = 0; PyObject *__pyx_v_bins = 0; PyArrayObject *__pyx_v_weights = 0; PyObject *__pyx_v_split = 0; PyObject *__pyx_v_nthread = 0; double __pyx_v_dummy; long __pyx_v_bin0; long __pyx_v_bin1; long __pyx_v_i; long __pyx_v_j; long __pyx_v_b0; long __pyx_v_b1; long __pyx_v_size; int __pyx_v_csplit; PyArrayObject *__pyx_v_cpos0 = 0; PyArrayObject *__pyx_v_cpos1 = 0; PyArrayObject *__pyx_v_data = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_edges0 = 0; PyArrayObject *__pyx_v_edges1 = 0; double __pyx_v_min0; double __pyx_v_max0; double __pyx_v_min1; double __pyx_v_max1; double __pyx_v_idp0; double __pyx_v_idp1; double __pyx_v_dbin0; double __pyx_v_dbin1; double __pyx_v_fbin0; double __pyx_v_fbin1; double __pyx_v_p0; double __pyx_v_p1; double __pyx_v_d; double __pyx_v_rest; double __pyx_v_delta0l; double __pyx_v_delta0r; double __pyx_v_delta1l; double __pyx_v_delta1r; double __pyx_v_area; Py_buffer __pyx_bstruct_edges0; Py_ssize_t __pyx_bstride_0_edges0 = 0; Py_ssize_t __pyx_bshape_0_edges0 = 0; Py_buffer __pyx_bstruct_edges1; Py_ssize_t __pyx_bstride_0_edges1 = 0; Py_ssize_t __pyx_bshape_0_edges1 = 0; Py_buffer __pyx_bstruct_outMerge; Py_ssize_t __pyx_bstride_0_outMerge = 0; Py_ssize_t __pyx_bstride_1_outMerge = 0; Py_ssize_t __pyx_bshape_0_outMerge = 0; Py_ssize_t __pyx_bshape_1_outMerge = 0; Py_buffer __pyx_bstruct_outCount; Py_ssize_t __pyx_bstride_0_outCount = 0; Py_ssize_t __pyx_bstride_1_outCount = 0; Py_ssize_t __pyx_bshape_0_outCount = 0; Py_ssize_t __pyx_bshape_1_outCount = 0; Py_buffer __pyx_bstruct_data; Py_ssize_t __pyx_bstride_0_data = 0; Py_ssize_t __pyx_bshape_0_data = 0; Py_buffer __pyx_bstruct_cpos1; Py_ssize_t __pyx_bstride_0_cpos1 = 0; Py_ssize_t __pyx_bshape_0_cpos1 = 0; Py_buffer __pyx_bstruct_cpos0; Py_ssize_t __pyx_bstride_0_cpos0 = 0; Py_ssize_t __pyx_bshape_0_cpos0 = 0; Py_buffer __pyx_bstruct_outData; Py_ssize_t __pyx_bstride_0_outData = 0; Py_ssize_t __pyx_bstride_1_outData = 0; Py_ssize_t __pyx_bshape_0_outData = 0; Py_ssize_t __pyx_bshape_1_outData = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; long __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; long __pyx_t_9; int __pyx_t_10; PyArrayObject *__pyx_t_11 = NULL; PyArrayObject *__pyx_t_12 = NULL; PyArrayObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyArrayObject *__pyx_t_15 = NULL; PyArrayObject *__pyx_t_16 = NULL; PyArrayObject *__pyx_t_17 = NULL; PyArrayObject *__pyx_t_18 = NULL; PyArrayObject *__pyx_t_19 = NULL; double __pyx_t_20; int __pyx_t_21; int __pyx_t_22; long __pyx_t_23; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; long __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; long __pyx_t_37; long __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; long __pyx_t_44; long __pyx_t_45; long __pyx_t_46; long __pyx_t_47; long __pyx_t_48; long __pyx_t_49; long __pyx_t_50; long __pyx_t_51; long __pyx_t_52; long __pyx_t_53; long __pyx_t_54; long __pyx_t_55; long __pyx_t_56; long __pyx_t_57; long __pyx_t_58; long __pyx_t_59; long __pyx_t_60; long __pyx_t_61; long __pyx_t_62; long __pyx_t_63; long __pyx_t_64; long __pyx_t_65; long __pyx_t_66; long __pyx_t_67; long __pyx_t_68; long __pyx_t_69; long __pyx_t_70; long __pyx_t_71; long __pyx_t_72; long __pyx_t_73; long __pyx_t_74; long __pyx_t_75; long __pyx_t_76; long __pyx_t_77; long __pyx_t_78; long __pyx_t_79; long __pyx_t_80; long __pyx_t_81; long __pyx_t_82; long __pyx_t_83; long __pyx_t_84; long __pyx_t_85; long __pyx_t_86; long __pyx_t_87; long __pyx_t_88; long __pyx_t_89; long __pyx_t_90; long __pyx_t_91; long __pyx_t_92; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos0,&__pyx_n_s__pos1,&__pyx_n_s__bins,&__pyx_n_s__weights,&__pyx_n_s__split,&__pyx_n_s__nthread,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("histogram2d"); __pyx_self = __pyx_self; { PyObject* values[7] = {0,0,0,0,0,0,0}; values[4] = __pyx_k_3; /* "histogram.pyx":199 * numpy.ndarray weights not None, * split=True, * nthread=None, # <<<<<<<<<<<<<< * double dummy=0.0): * """ */ values[5] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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 (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__split); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nthread); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[6] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "histogram2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { 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); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pos0 = ((PyArrayObject *)values[0]); __pyx_v_pos1 = ((PyArrayObject *)values[1]); __pyx_v_bins = values[2]; __pyx_v_weights = ((PyArrayObject *)values[3]); __pyx_v_split = values[4]; __pyx_v_nthread = values[5]; if (values[6]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "histogram.pyx":200 * split=True, * nthread=None, * double dummy=0.0): # <<<<<<<<<<<<<< * """ * Calculate 2D histogram of pos0,pos1 weighted by weights */ __pyx_v_dummy = ((double)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_cpos0.buf = NULL; __pyx_bstruct_cpos1.buf = NULL; __pyx_bstruct_data.buf = NULL; __pyx_bstruct_outData.buf = NULL; __pyx_bstruct_outCount.buf = NULL; __pyx_bstruct_outMerge.buf = NULL; __pyx_bstruct_edges0.buf = NULL; __pyx_bstruct_edges1.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos1), __pyx_ptype_5numpy_ndarray, 0, "pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_bins) == Py_None)) { PyErr_Format(PyExc_TypeError, "Argument 'bins' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "histogram.pyx":214 * @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D) * """ * assert pos0.size == pos1.size # <<<<<<<<<<<<<< * # if weights is not No: * assert pos0.size == weights.size */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "histogram.pyx":216 * assert pos0.size == pos1.size * # if weights is not No: * assert pos0.size == weights.size # <<<<<<<<<<<<<< * cdef long bin0, bin1, i, j, b0, b1 * cdef long size = pos0.size */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "histogram.pyx":218 * assert pos0.size == weights.size * cdef long bin0, bin1, i, j, b0, b1 * cdef long size = pos0.size # <<<<<<<<<<<<<< * try: * bin0, bin1 = tuple(bins) */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_5; /* "histogram.pyx":219 * cdef long bin0, bin1, i, j, b0, b1 * cdef long size = pos0.size * try: # <<<<<<<<<<<<<< * bin0, bin1 = tuple(bins) * except: */ { __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:*/ { /* "histogram.pyx":220 * cdef long size = pos0.size * try: * bin0, bin1 = tuple(bins) # <<<<<<<<<<<<<< * except: * bin0 = bin1 = < long > bins */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_bins); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bins); __Pyx_GIVEREF(__pyx_v_bins); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (likely(PyTuple_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __Pyx_UnpackTupleError(__pyx_t_2, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_bin0 = __pyx_t_5; __pyx_v_bin1 = __pyx_t_9; } __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_L13_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /* "histogram.pyx":221 * try: * bin0, bin1 = tuple(bins) * except: # <<<<<<<<<<<<<< * bin0 = bin1 = < long > bins * if bin0 <= 0: */ /*except:*/ { __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); /* "histogram.pyx":222 * bin0, bin1 = tuple(bins) * except: * bin0 = bin1 = < long > bins # <<<<<<<<<<<<<< * if bin0 <= 0: * bin0 = 1 */ __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __pyx_v_bin0 = ((long)__pyx_t_9); __pyx_v_bin1 = ((long)__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L7_exception_handled; } __pyx_L8_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_L7_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_L13_try_end:; } /* "histogram.pyx":223 * except: * bin0 = bin1 = < long > bins * if bin0 <= 0: # <<<<<<<<<<<<<< * bin0 = 1 * if bin1 <= 0: */ __pyx_t_4 = (__pyx_v_bin0 <= 0); if (__pyx_t_4) { /* "histogram.pyx":224 * bin0 = bin1 = < long > bins * if bin0 <= 0: * bin0 = 1 # <<<<<<<<<<<<<< * if bin1 <= 0: * bin1 = 1 */ __pyx_v_bin0 = 1; goto __pyx_L16; } __pyx_L16:; /* "histogram.pyx":225 * if bin0 <= 0: * bin0 = 1 * if bin1 <= 0: # <<<<<<<<<<<<<< * bin1 = 1 * cdef int csplit = split */ __pyx_t_4 = (__pyx_v_bin1 <= 0); if (__pyx_t_4) { /* "histogram.pyx":226 * bin0 = 1 * if bin1 <= 0: * bin1 = 1 # <<<<<<<<<<<<<< * cdef int csplit = split * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() */ __pyx_v_bin1 = 1; goto __pyx_L17; } __pyx_L17:; /* "histogram.pyx":227 * if bin1 <= 0: * bin1 = 1 * cdef int csplit = split # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() */ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_split); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_csplit = __pyx_t_10; /* "histogram.pyx":228 * bin1 = 1 * cdef int csplit = split * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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 = 228; __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 = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos0, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos0.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cpos0 = __pyx_bstruct_cpos0.strides[0]; __pyx_bshape_0_cpos0 = __pyx_bstruct_cpos0.shape[0]; } } __pyx_t_11 = 0; __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":229 * cdef int csplit = split * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos1, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos1.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cpos1 = __pyx_bstruct_cpos1.strides[0]; __pyx_bshape_0_cpos1 = __pyx_bstruct_cpos1.shape[0]; } } __pyx_t_12 = 0; __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "histogram.pyx":230 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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 = 230; __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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; } } __pyx_t_13 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":231 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_14)); __Pyx_GIVEREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bstride_1_outData = __pyx_bstruct_outData.strides[1]; __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; __pyx_bshape_1_outData = __pyx_bstruct_outData.shape[1]; } } __pyx_t_15 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":232 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_14, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bstride_1_outCount = __pyx_bstruct_outCount.strides[1]; __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; __pyx_bshape_1_outCount = __pyx_bstruct_outCount.shape[1]; } } __pyx_t_16 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":233 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_14)); __Pyx_GIVEREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bstride_1_outMerge = __pyx_bstruct_outMerge.strides[1]; __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; __pyx_bshape_1_outMerge = __pyx_bstruct_outMerge.shape[1]; } } __pyx_t_17 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "histogram.pyx":234 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64") * cdef double min0 = pos0.min() */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 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 = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_14, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_18 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges0, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges0.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_edges0 = __pyx_bstruct_edges0.strides[0]; __pyx_bshape_0_edges0 = __pyx_bstruct_edges0.shape[0]; } } __pyx_t_18 = 0; __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "histogram.pyx":235 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64") # <<<<<<<<<<<<<< * cdef double min0 = pos0.min() * cdef double max0 = pos0.max() */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = ((PyArrayObject *)__pyx_t_14); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges1, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges1.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_edges1 = __pyx_bstruct_edges1.strides[0]; __pyx_bshape_0_edges1 = __pyx_bstruct_edges1.shape[0]; } } __pyx_t_19 = 0; __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_14); __pyx_t_14 = 0; /* "histogram.pyx":236 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64") * cdef double min0 = pos0.min() # <<<<<<<<<<<<<< * cdef double max0 = pos0.max() * cdef double min1 = pos1.min() */ __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_min0 = __pyx_t_20; /* "histogram.pyx":237 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64") * cdef double min0 = pos0.min() * cdef double max0 = pos0.max() # <<<<<<<<<<<<<< * cdef double min1 = pos1.min() * cdef double max1 = pos1.max() */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_v_max0 = __pyx_t_20; /* "histogram.pyx":238 * cdef double min0 = pos0.min() * cdef double max0 = pos0.max() * cdef double min1 = pos1.min() # <<<<<<<<<<<<<< * cdef double max1 = pos1.max() * cdef double idp0 = (< double > bin0) / (max0 - min0) */ __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_min1 = __pyx_t_20; /* "histogram.pyx":239 * cdef double max0 = pos0.max() * cdef double min1 = pos1.min() * cdef double max1 = pos1.max() # <<<<<<<<<<<<<< * cdef double idp0 = (< double > bin0) / (max0 - min0) * cdef double idp1 = (< double > bin1) / (max1 - min1) */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_v_max1 = __pyx_t_20; /* "histogram.pyx":240 * cdef double min1 = pos1.min() * cdef double max1 = pos1.max() * cdef double idp0 = (< double > bin0) / (max0 - min0) # <<<<<<<<<<<<<< * cdef double idp1 = (< double > bin1) / (max1 - min1) * cdef double dbin0 = 0.5, dbin1 = 0.5 */ __pyx_v_idp0 = (((double)__pyx_v_bin0) / (__pyx_v_max0 - __pyx_v_min0)); /* "histogram.pyx":241 * cdef double max1 = pos1.max() * cdef double idp0 = (< double > bin0) / (max0 - min0) * cdef double idp1 = (< double > bin1) / (max1 - min1) # <<<<<<<<<<<<<< * cdef double dbin0 = 0.5, dbin1 = 0.5 * cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera */ __pyx_v_idp1 = (((double)__pyx_v_bin1) / (__pyx_v_max1 - __pyx_v_min1)); /* "histogram.pyx":242 * cdef double idp0 = (< double > bin0) / (max0 - min0) * cdef double idp1 = (< double > bin1) / (max1 - min1) * cdef double dbin0 = 0.5, dbin1 = 0.5 # <<<<<<<<<<<<<< * cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera * if nthread is not None: */ __pyx_v_dbin0 = 0.5; __pyx_v_dbin1 = 0.5; /* "histogram.pyx":244 * cdef double dbin0 = 0.5, dbin1 = 0.5 * cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera * if nthread is not None: # <<<<<<<<<<<<<< * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) */ __pyx_t_4 = (__pyx_v_nthread != Py_None); if (__pyx_t_4) { /* "histogram.pyx":245 * cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera * if nthread is not None: * if isinstance(nthread, int) and (nthread > 0): # <<<<<<<<<<<<<< * omp_set_num_threads(< int > nthread) * with nogil: */ __pyx_t_14 = ((PyObject *)((PyObject*)(&PyInt_Type))); __Pyx_INCREF(__pyx_t_14); __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_nthread, __pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_4) { __pyx_t_14 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_22 = __pyx_t_21; } else { __pyx_t_22 = __pyx_t_4; } if (__pyx_t_22) { /* "histogram.pyx":246 * if nthread is not None: * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) # <<<<<<<<<<<<<< * with nogil: * for i in prange(bin0): */ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_nthread); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} omp_set_num_threads(((int)__pyx_t_10)); goto __pyx_L19; } __pyx_L19:; goto __pyx_L18; } __pyx_L18:; /* "histogram.pyx":247 * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) * with nogil: # <<<<<<<<<<<<<< * for i in prange(bin0): * edges0[i] = min0 + (0.5 +< double > i) / idp0 */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "histogram.pyx":248 * omp_set_num_threads(< int > nthread) * with nogil: * for i in prange(bin0): # <<<<<<<<<<<<<< * edges0[i] = min0 + (0.5 +< double > i) / idp0 * for i in prange(bin1): */ __pyx_t_9 = __pyx_v_bin0; if (1 == 0) abort(); { __pyx_t_23 = (__pyx_t_9 - 0) / 1; if (__pyx_t_23 > 0) { __pyx_v_i = 0; #ifdef _OPENMP #pragma omp parallel private(__pyx_t_24) #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) #endif /* _OPENMP */ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_23; __pyx_t_5++){ { __pyx_v_i = 0 + 1 * __pyx_t_5; /* "histogram.pyx":249 * with nogil: * for i in prange(bin0): * edges0[i] = min0 + (0.5 +< double > i) / idp0 # <<<<<<<<<<<<<< * for i in prange(bin1): * edges1[i] = min1 + (0.5 +< double > i) / idp1 */ __pyx_t_24 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_edges0.buf, __pyx_t_24, __pyx_bstride_0_edges0) = (__pyx_v_min0 + ((0.5 + ((double)__pyx_v_i)) / __pyx_v_idp0)); } } } } } /* "histogram.pyx":250 * for i in prange(bin0): * edges0[i] = min0 + (0.5 +< double > i) / idp0 * for i in prange(bin1): # <<<<<<<<<<<<<< * edges1[i] = min1 + (0.5 +< double > i) / idp1 * for i in range(size): */ __pyx_t_23 = __pyx_v_bin1; if (1 == 0) abort(); { __pyx_t_9 = (__pyx_t_23 - 0) / 1; if (__pyx_t_9 > 0) { __pyx_v_i = 0; #ifdef _OPENMP #pragma omp parallel private(__pyx_t_25) #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) #endif /* _OPENMP */ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_9; __pyx_t_5++){ { __pyx_v_i = 0 + 1 * __pyx_t_5; /* "histogram.pyx":251 * edges0[i] = min0 + (0.5 +< double > i) / idp0 * for i in prange(bin1): * edges1[i] = min1 + (0.5 +< double > i) / idp1 # <<<<<<<<<<<<<< * for i in range(size): * p0 = cpos0[i] */ __pyx_t_25 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_edges1.buf, __pyx_t_25, __pyx_bstride_0_edges1) = (__pyx_v_min1 + ((0.5 + ((double)__pyx_v_i)) / __pyx_v_idp1)); } } } } } /* "histogram.pyx":252 * for i in prange(bin1): * edges1[i] = min1 + (0.5 +< double > i) / idp1 * for i in range(size): # <<<<<<<<<<<<<< * p0 = cpos0[i] * p1 = cpos1[i] */ __pyx_t_9 = __pyx_v_size; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_9; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; /* "histogram.pyx":253 * edges1[i] = min1 + (0.5 +< double > i) / idp1 * for i in range(size): * p0 = cpos0[i] # <<<<<<<<<<<<<< * p1 = cpos1[i] * d = data[i] */ __pyx_t_23 = __pyx_v_i; __pyx_v_p0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos0.buf, __pyx_t_23, __pyx_bstride_0_cpos0)); /* "histogram.pyx":254 * for i in range(size): * p0 = cpos0[i] * p1 = cpos1[i] # <<<<<<<<<<<<<< * d = data[i] * fbin0 = (p0 - min0) * idp0 */ __pyx_t_26 = __pyx_v_i; __pyx_v_p1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos1.buf, __pyx_t_26, __pyx_bstride_0_cpos1)); /* "histogram.pyx":255 * p0 = cpos0[i] * p1 = cpos1[i] * d = data[i] # <<<<<<<<<<<<<< * fbin0 = (p0 - min0) * idp0 * fbin1 = (p1 - min1) * idp1 */ __pyx_t_27 = __pyx_v_i; __pyx_v_d = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_data.buf, __pyx_t_27, __pyx_bstride_0_data)); /* "histogram.pyx":256 * p1 = cpos1[i] * d = data[i] * fbin0 = (p0 - min0) * idp0 # <<<<<<<<<<<<<< * fbin1 = (p1 - min1) * idp1 * b0 = < long > floor(fbin0) */ __pyx_v_fbin0 = ((__pyx_v_p0 - __pyx_v_min0) * __pyx_v_idp0); /* "histogram.pyx":257 * d = data[i] * fbin0 = (p0 - min0) * idp0 * fbin1 = (p1 - min1) * idp1 # <<<<<<<<<<<<<< * b0 = < long > floor(fbin0) * b1 = < long > floor(fbin1) */ __pyx_v_fbin1 = ((__pyx_v_p1 - __pyx_v_min1) * __pyx_v_idp1); /* "histogram.pyx":258 * fbin0 = (p0 - min0) * idp0 * fbin1 = (p1 - min1) * idp1 * b0 = < long > floor(fbin0) # <<<<<<<<<<<<<< * b1 = < long > floor(fbin1) * if b0 == bin0: */ __pyx_v_b0 = ((long)floor(__pyx_v_fbin0)); /* "histogram.pyx":259 * fbin1 = (p1 - min1) * idp1 * b0 = < long > floor(fbin0) * b1 = < long > floor(fbin1) # <<<<<<<<<<<<<< * if b0 == bin0: * b0 = bin0 - 1 */ __pyx_v_b1 = ((long)floor(__pyx_v_fbin1)); /* "histogram.pyx":260 * b0 = < long > floor(fbin0) * b1 = < long > floor(fbin1) * if b0 == bin0: # <<<<<<<<<<<<<< * b0 = bin0 - 1 * fbin0 = (< double > bin0) - 0.5 */ __pyx_t_22 = (__pyx_v_b0 == __pyx_v_bin0); if (__pyx_t_22) { /* "histogram.pyx":261 * b1 = < long > floor(fbin1) * if b0 == bin0: * b0 = bin0 - 1 # <<<<<<<<<<<<<< * fbin0 = (< double > bin0) - 0.5 * elif b0 == 0: */ __pyx_v_b0 = (__pyx_v_bin0 - 1); /* "histogram.pyx":262 * if b0 == bin0: * b0 = bin0 - 1 * fbin0 = (< double > bin0) - 0.5 # <<<<<<<<<<<<<< * elif b0 == 0: * fbin0 = 0.5 */ __pyx_v_fbin0 = (((double)__pyx_v_bin0) - 0.5); goto __pyx_L37; } /* "histogram.pyx":263 * b0 = bin0 - 1 * fbin0 = (< double > bin0) - 0.5 * elif b0 == 0: # <<<<<<<<<<<<<< * fbin0 = 0.5 * if b1 == bin1: */ __pyx_t_22 = (__pyx_v_b0 == 0); if (__pyx_t_22) { /* "histogram.pyx":264 * fbin0 = (< double > bin0) - 0.5 * elif b0 == 0: * fbin0 = 0.5 # <<<<<<<<<<<<<< * if b1 == bin1: * b1 = bin1 - 1 */ __pyx_v_fbin0 = 0.5; goto __pyx_L37; } __pyx_L37:; /* "histogram.pyx":265 * elif b0 == 0: * fbin0 = 0.5 * if b1 == bin1: # <<<<<<<<<<<<<< * b1 = bin1 - 1 * fbin1 = (< double > bin1) - 0.5 */ __pyx_t_22 = (__pyx_v_b1 == __pyx_v_bin1); if (__pyx_t_22) { /* "histogram.pyx":266 * fbin0 = 0.5 * if b1 == bin1: * b1 = bin1 - 1 # <<<<<<<<<<<<<< * fbin1 = (< double > bin1) - 0.5 * elif b1 == 0: */ __pyx_v_b1 = (__pyx_v_bin1 - 1); /* "histogram.pyx":267 * if b1 == bin1: * b1 = bin1 - 1 * fbin1 = (< double > bin1) - 0.5 # <<<<<<<<<<<<<< * elif b1 == 0: * fbin1 = 0.5 */ __pyx_v_fbin1 = (((double)__pyx_v_bin1) - 0.5); goto __pyx_L38; } /* "histogram.pyx":268 * b1 = bin1 - 1 * fbin1 = (< double > bin1) - 0.5 * elif b1 == 0: # <<<<<<<<<<<<<< * fbin1 = 0.5 * */ __pyx_t_22 = (__pyx_v_b1 == 0); if (__pyx_t_22) { /* "histogram.pyx":269 * fbin1 = (< double > bin1) - 0.5 * elif b1 == 0: * fbin1 = 0.5 # <<<<<<<<<<<<<< * * delta0l = fbin0 -< double > b0 - dbin0 */ __pyx_v_fbin1 = 0.5; goto __pyx_L38; } __pyx_L38:; /* "histogram.pyx":271 * fbin1 = 0.5 * * delta0l = fbin0 -< double > b0 - dbin0 # <<<<<<<<<<<<<< * delta0r = fbin0 -< double > b0 - 1 + dbin0 * delta1l = fbin1 -< double > b1 - dbin1 */ __pyx_v_delta0l = ((__pyx_v_fbin0 - ((double)__pyx_v_b0)) - __pyx_v_dbin0); /* "histogram.pyx":272 * * delta0l = fbin0 -< double > b0 - dbin0 * delta0r = fbin0 -< double > b0 - 1 + dbin0 # <<<<<<<<<<<<<< * delta1l = fbin1 -< double > b1 - dbin1 * delta1r = fbin1 -< double > b1 - 1 + dbin1 */ __pyx_v_delta0r = (((__pyx_v_fbin0 - ((double)__pyx_v_b0)) - 1.0) + __pyx_v_dbin0); /* "histogram.pyx":273 * delta0l = fbin0 -< double > b0 - dbin0 * delta0r = fbin0 -< double > b0 - 1 + dbin0 * delta1l = fbin1 -< double > b1 - dbin1 # <<<<<<<<<<<<<< * delta1r = fbin1 -< double > b1 - 1 + dbin1 * rest = 1.0 */ __pyx_v_delta1l = ((__pyx_v_fbin1 - ((double)__pyx_v_b1)) - __pyx_v_dbin1); /* "histogram.pyx":274 * delta0r = fbin0 -< double > b0 - 1 + dbin0 * delta1l = fbin1 -< double > b1 - dbin1 * delta1r = fbin1 -< double > b1 - 1 + dbin1 # <<<<<<<<<<<<<< * rest = 1.0 * if csplit == 1: */ __pyx_v_delta1r = (((__pyx_v_fbin1 - ((double)__pyx_v_b1)) - 1.0) + __pyx_v_dbin1); /* "histogram.pyx":275 * delta1l = fbin1 -< double > b1 - dbin1 * delta1r = fbin1 -< double > b1 - 1 + dbin1 * rest = 1.0 # <<<<<<<<<<<<<< * if csplit == 1: * if delta0l < 0 and b0 > 0: */ __pyx_v_rest = 1.0; /* "histogram.pyx":276 * delta1r = fbin1 -< double > b1 - 1 + dbin1 * rest = 1.0 * if csplit == 1: # <<<<<<<<<<<<<< * if delta0l < 0 and b0 > 0: * if delta1l < 0 and b1 > 0: */ __pyx_t_22 = (__pyx_v_csplit == 1); if (__pyx_t_22) { /* "histogram.pyx":277 * rest = 1.0 * if csplit == 1: * if delta0l < 0 and b0 > 0: # <<<<<<<<<<<<<< * if delta1l < 0 and b1 > 0: * area = delta0l * delta1l */ __pyx_t_22 = (__pyx_v_delta0l < 0.0); if (__pyx_t_22) { __pyx_t_4 = (__pyx_v_b0 > 0); __pyx_t_21 = __pyx_t_4; } else { __pyx_t_21 = __pyx_t_22; } if (__pyx_t_21) { /* "histogram.pyx":278 * if csplit == 1: * if delta0l < 0 and b0 > 0: * if delta1l < 0 and b1 > 0: # <<<<<<<<<<<<<< * area = delta0l * delta1l * rest -= area */ __pyx_t_21 = (__pyx_v_delta1l < 0.0); if (__pyx_t_21) { __pyx_t_22 = (__pyx_v_b1 > 0); __pyx_t_4 = __pyx_t_22; } else { __pyx_t_4 = __pyx_t_21; } if (__pyx_t_4) { /* "histogram.pyx":279 * if delta0l < 0 and b0 > 0: * if delta1l < 0 and b1 > 0: * area = delta0l * delta1l # <<<<<<<<<<<<<< * rest -= area * outCount[b0 - 1, b1 - 1] += area */ __pyx_v_area = (__pyx_v_delta0l * __pyx_v_delta1l); /* "histogram.pyx":280 * if delta1l < 0 and b1 > 0: * area = delta0l * delta1l * rest -= area # <<<<<<<<<<<<<< * outCount[b0 - 1, b1 - 1] += area * outData[b0 - 1, b1 - 1] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":281 * area = delta0l * delta1l * rest -= area * outCount[b0 - 1, b1 - 1] += area # <<<<<<<<<<<<<< * outData[b0 - 1, b1 - 1] += area * d * */ __pyx_t_28 = (__pyx_v_b0 - 1); __pyx_t_29 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_28, __pyx_bstride_0_outCount, __pyx_t_29, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":282 * rest -= area * outCount[b0 - 1, b1 - 1] += area * outData[b0 - 1, b1 - 1] += area * d # <<<<<<<<<<<<<< * * area = (-delta0l) * (1 + delta1l) */ __pyx_t_30 = (__pyx_v_b0 - 1); __pyx_t_31 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_30, __pyx_bstride_0_outData, __pyx_t_31, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":284 * outData[b0 - 1, b1 - 1] += area * d * * area = (-delta0l) * (1 + delta1l) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 - 1, b1 ] += area */ __pyx_v_area = ((-__pyx_v_delta0l) * (1.0 + __pyx_v_delta1l)); /* "histogram.pyx":285 * * area = (-delta0l) * (1 + delta1l) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 - 1, b1 ] += area * outData[b0 - 1, b1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":286 * area = (-delta0l) * (1 + delta1l) * rest -= area * outCount[b0 - 1, b1 ] += area # <<<<<<<<<<<<<< * outData[b0 - 1, b1 ] += area * d * */ __pyx_t_32 = (__pyx_v_b0 - 1); __pyx_t_33 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_32, __pyx_bstride_0_outCount, __pyx_t_33, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":287 * rest -= area * outCount[b0 - 1, b1 ] += area * outData[b0 - 1, b1 ] += area * d # <<<<<<<<<<<<<< * * area = (1 + delta0l) * (-delta1l) */ __pyx_t_34 = (__pyx_v_b0 - 1); __pyx_t_35 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_34, __pyx_bstride_0_outData, __pyx_t_35, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":289 * outData[b0 - 1, b1 ] += area * d * * area = (1 + delta0l) * (-delta1l) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 , b1 - 1 ] += area */ __pyx_v_area = ((1.0 + __pyx_v_delta0l) * (-__pyx_v_delta1l)); /* "histogram.pyx":290 * * area = (1 + delta0l) * (-delta1l) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 , b1 - 1 ] += area * outData[b0 , b1 - 1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":291 * area = (1 + delta0l) * (-delta1l) * rest -= area * outCount[b0 , b1 - 1 ] += area # <<<<<<<<<<<<<< * outData[b0 , b1 - 1 ] += area * d * */ __pyx_t_36 = __pyx_v_b0; __pyx_t_37 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_36, __pyx_bstride_0_outCount, __pyx_t_37, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":292 * rest -= area * outCount[b0 , b1 - 1 ] += area * outData[b0 , b1 - 1 ] += area * d # <<<<<<<<<<<<<< * * elif delta1r > 0 and b1 < bin1 - 1: */ __pyx_t_38 = __pyx_v_b0; __pyx_t_39 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_38, __pyx_bstride_0_outData, __pyx_t_39, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); goto __pyx_L41; } /* "histogram.pyx":294 * outData[b0 , b1 - 1 ] += area * d * * elif delta1r > 0 and b1 < bin1 - 1: # <<<<<<<<<<<<<< * area = -delta0l * delta1r * rest -= area */ __pyx_t_4 = (__pyx_v_delta1r > 0.0); if (__pyx_t_4) { __pyx_t_21 = (__pyx_v_b1 < (__pyx_v_bin1 - 1)); __pyx_t_22 = __pyx_t_21; } else { __pyx_t_22 = __pyx_t_4; } if (__pyx_t_22) { /* "histogram.pyx":295 * * elif delta1r > 0 and b1 < bin1 - 1: * area = -delta0l * delta1r # <<<<<<<<<<<<<< * rest -= area * outCount[b0 - 1, b1 + 1] += area */ __pyx_v_area = ((-__pyx_v_delta0l) * __pyx_v_delta1r); /* "histogram.pyx":296 * elif delta1r > 0 and b1 < bin1 - 1: * area = -delta0l * delta1r * rest -= area # <<<<<<<<<<<<<< * outCount[b0 - 1, b1 + 1] += area * outData[b0 - 1, b1 + 1] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":297 * area = -delta0l * delta1r * rest -= area * outCount[b0 - 1, b1 + 1] += area # <<<<<<<<<<<<<< * outData[b0 - 1, b1 + 1] += area * d * */ __pyx_t_40 = (__pyx_v_b0 - 1); __pyx_t_41 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_40, __pyx_bstride_0_outCount, __pyx_t_41, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":298 * rest -= area * outCount[b0 - 1, b1 + 1] += area * outData[b0 - 1, b1 + 1] += area * d # <<<<<<<<<<<<<< * * area = (-delta0l) * (1 - delta1r) */ __pyx_t_42 = (__pyx_v_b0 - 1); __pyx_t_43 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_42, __pyx_bstride_0_outData, __pyx_t_43, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":300 * outData[b0 - 1, b1 + 1] += area * d * * area = (-delta0l) * (1 - delta1r) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 - 1, b1 ] += area */ __pyx_v_area = ((-__pyx_v_delta0l) * (1.0 - __pyx_v_delta1r)); /* "histogram.pyx":301 * * area = (-delta0l) * (1 - delta1r) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 - 1, b1 ] += area * outData[b0 - 1, b1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":302 * area = (-delta0l) * (1 - delta1r) * rest -= area * outCount[b0 - 1, b1 ] += area # <<<<<<<<<<<<<< * outData[b0 - 1, b1 ] += area * d * */ __pyx_t_44 = (__pyx_v_b0 - 1); __pyx_t_45 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_44, __pyx_bstride_0_outCount, __pyx_t_45, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":303 * rest -= area * outCount[b0 - 1, b1 ] += area * outData[b0 - 1, b1 ] += area * d # <<<<<<<<<<<<<< * * area = (1 + delta0l) * (delta1r) */ __pyx_t_46 = (__pyx_v_b0 - 1); __pyx_t_47 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_46, __pyx_bstride_0_outData, __pyx_t_47, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":305 * outData[b0 - 1, b1 ] += area * d * * area = (1 + delta0l) * (delta1r) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 , b1 + 1 ] += area */ __pyx_v_area = ((1.0 + __pyx_v_delta0l) * __pyx_v_delta1r); /* "histogram.pyx":306 * * area = (1 + delta0l) * (delta1r) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":307 * area = (1 + delta0l) * (delta1r) * rest -= area * outCount[b0 , b1 + 1 ] += area # <<<<<<<<<<<<<< * outData[b0 , b1 + 1 ] += area * d * elif delta0r > 0 and b0 < bin0 - 1: */ __pyx_t_48 = __pyx_v_b0; __pyx_t_49 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_48, __pyx_bstride_0_outCount, __pyx_t_49, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":308 * rest -= area * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d # <<<<<<<<<<<<<< * elif delta0r > 0 and b0 < bin0 - 1: * if delta1l < 0 and b1 > 0: */ __pyx_t_50 = __pyx_v_b0; __pyx_t_51 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_50, __pyx_bstride_0_outData, __pyx_t_51, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); goto __pyx_L41; } __pyx_L41:; goto __pyx_L40; } /* "histogram.pyx":309 * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d * elif delta0r > 0 and b0 < bin0 - 1: # <<<<<<<<<<<<<< * if delta1l < 0 and b1 > 0: * area = -delta0r * delta1l */ __pyx_t_22 = (__pyx_v_delta0r > 0.0); if (__pyx_t_22) { __pyx_t_4 = (__pyx_v_b0 < (__pyx_v_bin0 - 1)); __pyx_t_21 = __pyx_t_4; } else { __pyx_t_21 = __pyx_t_22; } if (__pyx_t_21) { /* "histogram.pyx":310 * outData[b0 , b1 + 1 ] += area * d * elif delta0r > 0 and b0 < bin0 - 1: * if delta1l < 0 and b1 > 0: # <<<<<<<<<<<<<< * area = -delta0r * delta1l * rest -= area */ __pyx_t_21 = (__pyx_v_delta1l < 0.0); if (__pyx_t_21) { __pyx_t_22 = (__pyx_v_b1 > 0); __pyx_t_4 = __pyx_t_22; } else { __pyx_t_4 = __pyx_t_21; } if (__pyx_t_4) { /* "histogram.pyx":311 * elif delta0r > 0 and b0 < bin0 - 1: * if delta1l < 0 and b1 > 0: * area = -delta0r * delta1l # <<<<<<<<<<<<<< * rest -= area * outCount[b0 + 1, b1 - 1] += area */ __pyx_v_area = ((-__pyx_v_delta0r) * __pyx_v_delta1l); /* "histogram.pyx":312 * if delta1l < 0 and b1 > 0: * area = -delta0r * delta1l * rest -= area # <<<<<<<<<<<<<< * outCount[b0 + 1, b1 - 1] += area * outData[b0 + 1, b1 - 1] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":313 * area = -delta0r * delta1l * rest -= area * outCount[b0 + 1, b1 - 1] += area # <<<<<<<<<<<<<< * outData[b0 + 1, b1 - 1] += area * d * */ __pyx_t_52 = (__pyx_v_b0 + 1); __pyx_t_53 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_52, __pyx_bstride_0_outCount, __pyx_t_53, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":314 * rest -= area * outCount[b0 + 1, b1 - 1] += area * outData[b0 + 1, b1 - 1] += area * d # <<<<<<<<<<<<<< * * area = (delta0r) * (1 + delta1l) */ __pyx_t_54 = (__pyx_v_b0 + 1); __pyx_t_55 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_54, __pyx_bstride_0_outData, __pyx_t_55, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":316 * outData[b0 + 1, b1 - 1] += area * d * * area = (delta0r) * (1 + delta1l) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 + 1, b1 ] += area */ __pyx_v_area = (__pyx_v_delta0r * (1.0 + __pyx_v_delta1l)); /* "histogram.pyx":317 * * area = (delta0r) * (1 + delta1l) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 + 1, b1 ] += area * outData[b0 + 1, b1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":318 * area = (delta0r) * (1 + delta1l) * rest -= area * outCount[b0 + 1, b1 ] += area # <<<<<<<<<<<<<< * outData[b0 + 1, b1 ] += area * d * */ __pyx_t_56 = (__pyx_v_b0 + 1); __pyx_t_57 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_56, __pyx_bstride_0_outCount, __pyx_t_57, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":319 * rest -= area * outCount[b0 + 1, b1 ] += area * outData[b0 + 1, b1 ] += area * d # <<<<<<<<<<<<<< * * area = (1 - delta0r) * (-delta1l) */ __pyx_t_58 = (__pyx_v_b0 + 1); __pyx_t_59 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_58, __pyx_bstride_0_outData, __pyx_t_59, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":321 * outData[b0 + 1, b1 ] += area * d * * area = (1 - delta0r) * (-delta1l) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 , b1 - 1 ] += area */ __pyx_v_area = ((1.0 - __pyx_v_delta0r) * (-__pyx_v_delta1l)); /* "histogram.pyx":322 * * area = (1 - delta0r) * (-delta1l) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 , b1 - 1 ] += area * outData[b0 , b1 - 1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":323 * area = (1 - delta0r) * (-delta1l) * rest -= area * outCount[b0 , b1 - 1 ] += area # <<<<<<<<<<<<<< * outData[b0 , b1 - 1 ] += area * d * */ __pyx_t_60 = __pyx_v_b0; __pyx_t_61 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_60, __pyx_bstride_0_outCount, __pyx_t_61, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":324 * rest -= area * outCount[b0 , b1 - 1 ] += area * outData[b0 , b1 - 1 ] += area * d # <<<<<<<<<<<<<< * * elif delta1r > 0 and b1 < bin1 - 1: */ __pyx_t_62 = __pyx_v_b0; __pyx_t_63 = (__pyx_v_b1 - 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_62, __pyx_bstride_0_outData, __pyx_t_63, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); goto __pyx_L42; } /* "histogram.pyx":326 * outData[b0 , b1 - 1 ] += area * d * * elif delta1r > 0 and b1 < bin1 - 1: # <<<<<<<<<<<<<< * area = delta0r * delta1r * rest -= area */ __pyx_t_4 = (__pyx_v_delta1r > 0.0); if (__pyx_t_4) { __pyx_t_21 = (__pyx_v_b1 < (__pyx_v_bin1 - 1)); __pyx_t_22 = __pyx_t_21; } else { __pyx_t_22 = __pyx_t_4; } if (__pyx_t_22) { /* "histogram.pyx":327 * * elif delta1r > 0 and b1 < bin1 - 1: * area = delta0r * delta1r # <<<<<<<<<<<<<< * rest -= area * outCount[b0 + 1, b1 + 1] += area */ __pyx_v_area = (__pyx_v_delta0r * __pyx_v_delta1r); /* "histogram.pyx":328 * elif delta1r > 0 and b1 < bin1 - 1: * area = delta0r * delta1r * rest -= area # <<<<<<<<<<<<<< * outCount[b0 + 1, b1 + 1] += area * outData[b0 + 1, b1 + 1] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":329 * area = delta0r * delta1r * rest -= area * outCount[b0 + 1, b1 + 1] += area # <<<<<<<<<<<<<< * outData[b0 + 1, b1 + 1] += area * d * */ __pyx_t_64 = (__pyx_v_b0 + 1); __pyx_t_65 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_64, __pyx_bstride_0_outCount, __pyx_t_65, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":330 * rest -= area * outCount[b0 + 1, b1 + 1] += area * outData[b0 + 1, b1 + 1] += area * d # <<<<<<<<<<<<<< * * area = (delta0r) * (1 - delta1r) */ __pyx_t_66 = (__pyx_v_b0 + 1); __pyx_t_67 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_66, __pyx_bstride_0_outData, __pyx_t_67, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":332 * outData[b0 + 1, b1 + 1] += area * d * * area = (delta0r) * (1 - delta1r) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 + 1, b1 ] += area */ __pyx_v_area = (__pyx_v_delta0r * (1.0 - __pyx_v_delta1r)); /* "histogram.pyx":333 * * area = (delta0r) * (1 - delta1r) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 + 1, b1 ] += area * outData[b0 + 1, b1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":334 * area = (delta0r) * (1 - delta1r) * rest -= area * outCount[b0 + 1, b1 ] += area # <<<<<<<<<<<<<< * outData[b0 + 1, b1 ] += area * d * */ __pyx_t_68 = (__pyx_v_b0 + 1); __pyx_t_69 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_68, __pyx_bstride_0_outCount, __pyx_t_69, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":335 * rest -= area * outCount[b0 + 1, b1 ] += area * outData[b0 + 1, b1 ] += area * d # <<<<<<<<<<<<<< * * area = (1 - delta0r) * (delta1r) */ __pyx_t_70 = (__pyx_v_b0 + 1); __pyx_t_71 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_70, __pyx_bstride_0_outData, __pyx_t_71, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); /* "histogram.pyx":337 * outData[b0 + 1, b1 ] += area * d * * area = (1 - delta0r) * (delta1r) # <<<<<<<<<<<<<< * rest -= area * outCount[b0 , b1 + 1 ] += area */ __pyx_v_area = ((1.0 - __pyx_v_delta0r) * __pyx_v_delta1r); /* "histogram.pyx":338 * * area = (1 - delta0r) * (delta1r) * rest -= area # <<<<<<<<<<<<<< * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d */ __pyx_v_rest = (__pyx_v_rest - __pyx_v_area); /* "histogram.pyx":339 * area = (1 - delta0r) * (delta1r) * rest -= area * outCount[b0 , b1 + 1 ] += area # <<<<<<<<<<<<<< * outData[b0 , b1 + 1 ] += area * d * outCount[b0, b1] += rest */ __pyx_t_72 = __pyx_v_b0; __pyx_t_73 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_72, __pyx_bstride_0_outCount, __pyx_t_73, __pyx_bstride_1_outCount) += __pyx_v_area; /* "histogram.pyx":340 * rest -= area * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d # <<<<<<<<<<<<<< * outCount[b0, b1] += rest * outData[b0, b1] += d * rest */ __pyx_t_74 = __pyx_v_b0; __pyx_t_75 = (__pyx_v_b1 + 1); *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_74, __pyx_bstride_0_outData, __pyx_t_75, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d); goto __pyx_L42; } __pyx_L42:; goto __pyx_L40; } __pyx_L40:; goto __pyx_L39; } __pyx_L39:; /* "histogram.pyx":341 * outCount[b0 , b1 + 1 ] += area * outData[b0 , b1 + 1 ] += area * d * outCount[b0, b1] += rest # <<<<<<<<<<<<<< * outData[b0, b1] += d * rest * */ __pyx_t_76 = __pyx_v_b0; __pyx_t_77 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_76, __pyx_bstride_0_outCount, __pyx_t_77, __pyx_bstride_1_outCount) += __pyx_v_rest; /* "histogram.pyx":342 * outData[b0 , b1 + 1 ] += area * d * outCount[b0, b1] += rest * outData[b0, b1] += d * rest # <<<<<<<<<<<<<< * * for i in prange(bin0): */ __pyx_t_78 = __pyx_v_b0; __pyx_t_79 = __pyx_v_b1; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_78, __pyx_bstride_0_outData, __pyx_t_79, __pyx_bstride_1_outData) += (__pyx_v_d * __pyx_v_rest); } /* "histogram.pyx":344 * outData[b0, b1] += d * rest * * for i in prange(bin0): # <<<<<<<<<<<<<< * for j in range(bin1): * if outCount[i, j] > 1e-10: */ __pyx_t_9 = __pyx_v_bin0; if (1 == 0) abort(); { __pyx_t_80 = (__pyx_t_9 - 0) / 1; if (__pyx_t_80 > 0) { __pyx_v_i = 0; #ifdef _OPENMP #pragma omp parallel private(__pyx_t_86, __pyx_t_83, __pyx_t_88, __pyx_t_87, __pyx_t_92, __pyx_t_89, __pyx_t_84, __pyx_t_81, __pyx_t_91, __pyx_t_85, __pyx_t_82, __pyx_t_22, __pyx_t_90) #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for lastprivate(__pyx_v_j) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) #endif /* _OPENMP */ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_80; __pyx_t_5++){ { __pyx_v_i = 0 + 1 * __pyx_t_5; /* Initialize private variables to invalid values */ __pyx_v_j = ((long)0xbad0bad0); /* "histogram.pyx":345 * * for i in prange(bin0): * for j in range(bin1): # <<<<<<<<<<<<<< * if outCount[i, j] > 1e-10: * outMerge[i, j] += outData[i, j] / outCount[i, j] */ __pyx_t_81 = __pyx_v_bin1; for (__pyx_t_82 = 0; __pyx_t_82 < __pyx_t_81; __pyx_t_82+=1) { __pyx_v_j = __pyx_t_82; /* "histogram.pyx":346 * for i in prange(bin0): * for j in range(bin1): * if outCount[i, j] > 1e-10: # <<<<<<<<<<<<<< * outMerge[i, j] += outData[i, j] / outCount[i, j] * else: */ __pyx_t_83 = __pyx_v_i; __pyx_t_84 = __pyx_v_j; __pyx_t_22 = ((*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_83, __pyx_bstride_0_outCount, __pyx_t_84, __pyx_bstride_1_outCount)) > 1e-10); if (__pyx_t_22) { /* "histogram.pyx":347 * for j in range(bin1): * if outCount[i, j] > 1e-10: * outMerge[i, j] += outData[i, j] / outCount[i, j] # <<<<<<<<<<<<<< * else: * outMerge[i, j] += dummy */ __pyx_t_85 = __pyx_v_i; __pyx_t_86 = __pyx_v_j; __pyx_t_87 = __pyx_v_i; __pyx_t_88 = __pyx_v_j; __pyx_t_89 = __pyx_v_i; __pyx_t_90 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_89, __pyx_bstride_0_outMerge, __pyx_t_90, __pyx_bstride_1_outMerge) += ((*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_85, __pyx_bstride_0_outData, __pyx_t_86, __pyx_bstride_1_outData)) / (*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_87, __pyx_bstride_0_outCount, __pyx_t_88, __pyx_bstride_1_outCount))); goto __pyx_L49; } /*else*/ { /* "histogram.pyx":349 * outMerge[i, j] += outData[i, j] / outCount[i, j] * else: * outMerge[i, j] += dummy # <<<<<<<<<<<<<< * * */ __pyx_t_91 = __pyx_v_i; __pyx_t_92 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_91, __pyx_bstride_0_outMerge, __pyx_t_92, __pyx_bstride_1_outMerge) += __pyx_v_dummy; } __pyx_L49:; } } } } } } } /* "histogram.pyx":247 * if isinstance(nthread, int) and (nthread > 0): * omp_set_num_threads(< int > nthread) * with nogil: # <<<<<<<<<<<<<< * for i in prange(bin0): * edges0[i] = min0 + (0.5 +< double > i) / idp0 */ /*finally:*/ { Py_BLOCK_THREADS } } /* "histogram.pyx":352 * * * return outMerge, edges0, edges1, outData, outCount # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_14 = PyTuple_New(5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); __Pyx_INCREF(((PyObject *)__pyx_v_outMerge)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge)); __Pyx_INCREF(((PyObject *)__pyx_v_edges0)); PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_v_edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0)); __Pyx_INCREF(((PyObject *)__pyx_v_edges1)); PyTuple_SET_ITEM(__pyx_t_14, 2, ((PyObject *)__pyx_v_edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1)); __Pyx_INCREF(((PyObject *)__pyx_v_outData)); PyTuple_SET_ITEM(__pyx_t_14, 3, ((PyObject *)__pyx_v_outData)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outData)); __Pyx_INCREF(((PyObject *)__pyx_v_outCount)); PyTuple_SET_ITEM(__pyx_t_14, 4, ((PyObject *)__pyx_v_outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount)); __pyx_r = ((PyObject *)__pyx_t_14); __pyx_t_14 = 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_14); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cpos0); __Pyx_XDECREF((PyObject *)__pyx_v_cpos1); __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_edges0); __Pyx_XDECREF((PyObject *)__pyx_v_edges1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":190 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":196 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":199 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":200 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":202 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":204 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":205 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L6; } /*else*/ { /* "numpy.pxd":207 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L6:; /* "numpy.pxd":209 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":210 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":213 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":218 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":219 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":222 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":223 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":224 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":225 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); /* "numpy.pxd":226 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } goto __pyx_L9; } /*else*/ { /* "numpy.pxd":228 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":229 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } __pyx_L9:; /* "numpy.pxd":230 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":231 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":232 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":235 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":236 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; /* "numpy.pxd":240 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":242 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":244 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L12; } /*else*/ { /* "numpy.pxd":247 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L12:; /* "numpy.pxd":249 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":250 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; /* "numpy.pxd":251 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":252 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "numpy.pxd":254 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L15; } /* "numpy.pxd":255 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L15; } /* "numpy.pxd":256 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L15; } /* "numpy.pxd":257 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L15; } /* "numpy.pxd":258 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L15; } /* "numpy.pxd":259 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L15; } /* "numpy.pxd":260 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L15; } /* "numpy.pxd":261 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L15; } /* "numpy.pxd":262 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L15; } /* "numpy.pxd":263 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L15; } /* "numpy.pxd":264 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L15; } /* "numpy.pxd":265 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L15; } /* "numpy.pxd":266 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L15; } /* "numpy.pxd":267 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L15; } /* "numpy.pxd":268 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L15; } /* "numpy.pxd":269 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L15; } /* "numpy.pxd":270 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L15; } /*else*/ { /* "numpy.pxd":272 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L15:; /* "numpy.pxd":273 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":274 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = '^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":277 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":278 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":281 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":282 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = 0; } __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":284 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); /* "numpy.pxd":285 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { /* "numpy.pxd":286 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":287 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":288 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L6; } __pyx_L6:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":764 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); /* "numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":767 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":770 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":773 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":776 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":779 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); /* "numpy.pxd":786 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":787 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":790 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":791 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":792 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":794 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":797 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; } else { __pyx_t_7 = __pyx_t_6; } if (!__pyx_t_7) { /* "numpy.pxd":798 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { __pyx_t_8 = (!__pyx_v_little_endian); __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":809 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; /* "numpy.pxd":810 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":811 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":812 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } /* "numpy.pxd":814 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); /* "numpy.pxd":816 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { /* "numpy.pxd":817 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":818 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "numpy.pxd":822 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } /* "numpy.pxd":823 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } /* "numpy.pxd":824 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } /* "numpy.pxd":825 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } /* "numpy.pxd":826 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } /* "numpy.pxd":827 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } /* "numpy.pxd":828 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } /* "numpy.pxd":829 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } /* "numpy.pxd":830 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } /* "numpy.pxd":831 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } /* "numpy.pxd":832 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } /* "numpy.pxd":833 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } /* "numpy.pxd":834 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } /* "numpy.pxd":835 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":836 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":837 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":838 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":840 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; /* "numpy.pxd":841 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { /* "numpy.pxd":845 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_11; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":846 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":961 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); /* "numpy.pxd":963 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":964 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":966 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":967 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":968 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":969 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); /* "numpy.pxd":972 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":973 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":975 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("histogram"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, {&__pyx_n_s__aera, __pyx_k__aera, sizeof(__pyx_k__aera), 0, 0, 1, 1}, {&__pyx_n_s__area, __pyx_k__area, sizeof(__pyx_k__area), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, {&__pyx_n_s__b0, __pyx_k__b0, sizeof(__pyx_k__b0), 0, 0, 1, 1}, {&__pyx_n_s__b1, __pyx_k__b1, sizeof(__pyx_k__b1), 0, 0, 1, 1}, {&__pyx_n_s__bigCount, __pyx_k__bigCount, sizeof(__pyx_k__bigCount), 0, 0, 1, 1}, {&__pyx_n_s__bigData, __pyx_k__bigData, sizeof(__pyx_k__bigData), 0, 0, 1, 1}, {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1}, {&__pyx_n_s__bin0, __pyx_k__bin0, sizeof(__pyx_k__bin0), 0, 0, 1, 1}, {&__pyx_n_s__bin1, __pyx_k__bin1, sizeof(__pyx_k__bin1), 0, 0, 1, 1}, {&__pyx_n_s__bin_edge_max, __pyx_k__bin_edge_max, sizeof(__pyx_k__bin_edge_max), 0, 0, 1, 1}, {&__pyx_n_s__bin_edge_min, __pyx_k__bin_edge_min, sizeof(__pyx_k__bin_edge_min), 0, 0, 1, 1}, {&__pyx_n_s__bin_range, __pyx_k__bin_range, sizeof(__pyx_k__bin_range), 0, 0, 1, 1}, {&__pyx_n_s__bin_width, __pyx_k__bin_width, sizeof(__pyx_k__bin_width), 0, 0, 1, 1}, {&__pyx_n_s__bins, __pyx_k__bins, sizeof(__pyx_k__bins), 0, 0, 1, 1}, {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1}, {&__pyx_n_s__cpos, __pyx_k__cpos, sizeof(__pyx_k__cpos), 0, 0, 1, 1}, {&__pyx_n_s__cpos0, __pyx_k__cpos0, sizeof(__pyx_k__cpos0), 0, 0, 1, 1}, {&__pyx_n_s__cpos1, __pyx_k__cpos1, sizeof(__pyx_k__cpos1), 0, 0, 1, 1}, {&__pyx_n_s__csplit, __pyx_k__csplit, sizeof(__pyx_k__csplit), 0, 0, 1, 1}, {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, {&__pyx_n_s__dInt, __pyx_k__dInt, sizeof(__pyx_k__dInt), 0, 0, 1, 1}, {&__pyx_n_s__dIntL, __pyx_k__dIntL, sizeof(__pyx_k__dIntL), 0, 0, 1, 1}, {&__pyx_n_s__dIntR, __pyx_k__dIntR, sizeof(__pyx_k__dIntR), 0, 0, 1, 1}, {&__pyx_n_s__dTmp, __pyx_k__dTmp, sizeof(__pyx_k__dTmp), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__dbin, __pyx_k__dbin, sizeof(__pyx_k__dbin), 0, 0, 1, 1}, {&__pyx_n_s__dbin0, __pyx_k__dbin0, sizeof(__pyx_k__dbin0), 0, 0, 1, 1}, {&__pyx_n_s__dbin1, __pyx_k__dbin1, sizeof(__pyx_k__dbin1), 0, 0, 1, 1}, {&__pyx_n_s__delta0l, __pyx_k__delta0l, sizeof(__pyx_k__delta0l), 0, 0, 1, 1}, {&__pyx_n_s__delta0r, __pyx_k__delta0r, sizeof(__pyx_k__delta0r), 0, 0, 1, 1}, {&__pyx_n_s__delta1l, __pyx_k__delta1l, sizeof(__pyx_k__delta1l), 0, 0, 1, 1}, {&__pyx_n_s__delta1r, __pyx_k__delta1r, sizeof(__pyx_k__delta1r), 0, 0, 1, 1}, {&__pyx_n_s__dest, __pyx_k__dest, sizeof(__pyx_k__dest), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtmp, __pyx_k__dtmp, sizeof(__pyx_k__dtmp), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__dummy, __pyx_k__dummy, sizeof(__pyx_k__dummy), 0, 0, 1, 1}, {&__pyx_n_s__edges0, __pyx_k__edges0, sizeof(__pyx_k__edges0), 0, 0, 1, 1}, {&__pyx_n_s__edges1, __pyx_k__edges1, sizeof(__pyx_k__edges1), 0, 0, 1, 1}, {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1}, {&__pyx_n_s__epsilon, __pyx_k__epsilon, sizeof(__pyx_k__epsilon), 0, 0, 1, 1}, {&__pyx_n_s__fbin, __pyx_k__fbin, sizeof(__pyx_k__fbin), 0, 0, 1, 1}, {&__pyx_n_s__fbin0, __pyx_k__fbin0, sizeof(__pyx_k__fbin0), 0, 0, 1, 1}, {&__pyx_n_s__fbin1, __pyx_k__fbin1, sizeof(__pyx_k__fbin1), 0, 0, 1, 1}, {&__pyx_n_s__ffbin, __pyx_k__ffbin, sizeof(__pyx_k__ffbin), 0, 0, 1, 1}, {&__pyx_n_s__finfo, __pyx_k__finfo, sizeof(__pyx_k__finfo), 0, 0, 1, 1}, {&__pyx_n_s__flatten, __pyx_k__flatten, sizeof(__pyx_k__flatten), 0, 0, 1, 1}, {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, {&__pyx_n_s__histogram, __pyx_k__histogram, sizeof(__pyx_k__histogram), 0, 0, 1, 1}, {&__pyx_n_s__histogram2d, __pyx_k__histogram2d, sizeof(__pyx_k__histogram2d), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__idp0, __pyx_k__idp0, sizeof(__pyx_k__idp0), 0, 0, 1, 1}, {&__pyx_n_s__idp1, __pyx_k__idp1, sizeof(__pyx_k__idp1), 0, 0, 1, 1}, {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, {&__pyx_n_s__inv_bin_width, __pyx_k__inv_bin_width, sizeof(__pyx_k__inv_bin_width), 0, 0, 1, 1}, {&__pyx_n_s__inv_dbin2, __pyx_k__inv_dbin2, sizeof(__pyx_k__inv_dbin2), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, {&__pyx_n_s__max0, __pyx_k__max0, sizeof(__pyx_k__max0), 0, 0, 1, 1}, {&__pyx_n_s__max1, __pyx_k__max1, sizeof(__pyx_k__max1), 0, 0, 1, 1}, {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, {&__pyx_n_s__min0, __pyx_k__min0, sizeof(__pyx_k__min0), 0, 0, 1, 1}, {&__pyx_n_s__min1, __pyx_k__min1, sizeof(__pyx_k__min1), 0, 0, 1, 1}, {&__pyx_n_s__nthread, __pyx_k__nthread, sizeof(__pyx_k__nthread), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__outCount, __pyx_k__outCount, sizeof(__pyx_k__outCount), 0, 0, 1, 1}, {&__pyx_n_s__outData, __pyx_k__outData, sizeof(__pyx_k__outData), 0, 0, 1, 1}, {&__pyx_n_s__outMerge, __pyx_k__outMerge, sizeof(__pyx_k__outMerge), 0, 0, 1, 1}, {&__pyx_n_s__outPos, __pyx_k__outPos, sizeof(__pyx_k__outPos), 0, 0, 1, 1}, {&__pyx_n_s__p0, __pyx_k__p0, sizeof(__pyx_k__p0), 0, 0, 1, 1}, {&__pyx_n_s__p1, __pyx_k__p1, sizeof(__pyx_k__p1), 0, 0, 1, 1}, {&__pyx_n_s__pixelSize_in_Pos, __pyx_k__pixelSize_in_Pos, sizeof(__pyx_k__pixelSize_in_Pos), 0, 0, 1, 1}, {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, {&__pyx_n_s__pos0, __pyx_k__pos0, sizeof(__pyx_k__pos0), 0, 0, 1, 1}, {&__pyx_n_s__pos1, __pyx_k__pos1, sizeof(__pyx_k__pos1), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__ravel, __pyx_k__ravel, sizeof(__pyx_k__ravel), 0, 0, 1, 1}, {&__pyx_n_s__rest, __pyx_k__rest, sizeof(__pyx_k__rest), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, {&__pyx_n_s__temp, __pyx_k__temp, sizeof(__pyx_k__temp), 0, 0, 1, 1}, {&__pyx_n_s__tmp_count, __pyx_k__tmp_count, sizeof(__pyx_k__tmp_count), 0, 0, 1, 1}, {&__pyx_n_s__tmp_data, __pyx_k__tmp_data, sizeof(__pyx_k__tmp_data), 0, 0, 1, 1}, {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "histogram.pyx":92 * assert bins > 1 * cdef long size = pos.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") */ __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); /* "histogram.pyx":93 * cdef long size = pos.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "histogram.pyx":228 * bin1 = 1 * cdef int csplit = split * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() */ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "histogram.pyx":229 * cdef int csplit = split * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); /* "histogram.pyx":230 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64") */ __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_17)); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_17)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); /* "histogram.pyx":69 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram(numpy.ndarray pos not None, \ # <<<<<<<<<<<<<< * numpy.ndarray weights not None, \ * long bins=100, */ __pyx_k_tuple_19 = PyTuple_New(40); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_range)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__bin_range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pixelSize_in_Pos)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__pixelSize_in_Pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pixelSize_in_Pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__nthread)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__nthread)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nthread)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__cpos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__temp)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__temp)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__temp)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_edge_min)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__bin_edge_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_edge_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_edge_max)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__bin_edge_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_edge_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_width)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 17, ((PyObject *)__pyx_n_s__bin_width)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_width)); __Pyx_INCREF(((PyObject *)__pyx_n_s__inv_bin_width)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 18, ((PyObject *)__pyx_n_s__inv_bin_width)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inv_bin_width)); __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 19, ((PyObject *)__pyx_n_s__a)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 20, ((PyObject *)__pyx_n_s__d)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 21, ((PyObject *)__pyx_n_s__fbin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ffbin)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 22, ((PyObject *)__pyx_n_s__ffbin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ffbin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dInt)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 23, ((PyObject *)__pyx_n_s__dInt)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dInt)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dIntR)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 24, ((PyObject *)__pyx_n_s__dIntR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dIntR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dIntL)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 25, ((PyObject *)__pyx_n_s__dIntL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dIntL)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dTmp)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 26, ((PyObject *)__pyx_n_s__dTmp)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dTmp)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 27, ((PyObject *)__pyx_n_s__dbin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__inv_dbin2)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 28, ((PyObject *)__pyx_n_s__inv_dbin2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inv_dbin2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp_count)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 29, ((PyObject *)__pyx_n_s__tmp_count)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp_count)); __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp_data)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 30, ((PyObject *)__pyx_n_s__tmp_data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp_data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 31, ((PyObject *)__pyx_n_s__epsilon)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 32, ((PyObject *)__pyx_n_s__bin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 33, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 34, ((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_19, 35, ((PyObject *)__pyx_n_s__t)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dest)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 36, ((PyObject *)__pyx_n_s__dest)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dest)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bigCount)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 37, ((PyObject *)__pyx_n_s__bigCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bigData)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 38, ((PyObject *)__pyx_n_s__bigData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dtmp)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 39, ((PyObject *)__pyx_n_s__dtmp)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dtmp)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(7, 0, 40, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__histogram, 69, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "histogram.pyx":194 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram2d(numpy.ndarray pos0 not None, # <<<<<<<<<<<<<< * numpy.ndarray pos1 not None, * bins not None, */ __pyx_k_tuple_22 = PyTuple_New(43); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__pos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, ((PyObject *)__pyx_n_s__pos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 3, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__split)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 4, ((PyObject *)__pyx_n_s__split)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__split)); __Pyx_INCREF(((PyObject *)__pyx_n_s__nthread)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 5, ((PyObject *)__pyx_n_s__nthread)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nthread)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 6, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 7, ((PyObject *)__pyx_n_s__bin0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 8, ((PyObject *)__pyx_n_s__bin1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 9, ((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_22, 10, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__b0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 11, ((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_22, 12, ((PyObject *)__pyx_n_s__b1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 13, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__csplit)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 14, ((PyObject *)__pyx_n_s__csplit)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csplit)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 15, ((PyObject *)__pyx_n_s__cpos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 16, ((PyObject *)__pyx_n_s__cpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 17, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 18, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 19, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 20, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 21, ((PyObject *)__pyx_n_s__edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 22, ((PyObject *)__pyx_n_s__edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 23, ((PyObject *)__pyx_n_s__min0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 24, ((PyObject *)__pyx_n_s__max0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 25, ((PyObject *)__pyx_n_s__min1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 26, ((PyObject *)__pyx_n_s__max1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idp0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 27, ((PyObject *)__pyx_n_s__idp0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idp0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idp1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 28, ((PyObject *)__pyx_n_s__idp1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idp1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 29, ((PyObject *)__pyx_n_s__dbin0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 30, ((PyObject *)__pyx_n_s__dbin1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 31, ((PyObject *)__pyx_n_s__fbin0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 32, ((PyObject *)__pyx_n_s__fbin1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__p0)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 33, ((PyObject *)__pyx_n_s__p0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__p1)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 34, ((PyObject *)__pyx_n_s__p1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 35, ((PyObject *)__pyx_n_s__d)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); __Pyx_INCREF(((PyObject *)__pyx_n_s__rest)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 36, ((PyObject *)__pyx_n_s__rest)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rest)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0l)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 37, ((PyObject *)__pyx_n_s__delta0l)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0l)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0r)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 38, ((PyObject *)__pyx_n_s__delta0r)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0r)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1l)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 39, ((PyObject *)__pyx_n_s__delta1l)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1l)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1r)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 40, ((PyObject *)__pyx_n_s__delta1r)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1r)); __Pyx_INCREF(((PyObject *)__pyx_n_s__aera)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 41, ((PyObject *)__pyx_n_s__aera)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aera)); __Pyx_INCREF(((PyObject *)__pyx_n_s__area)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 42, ((PyObject *)__pyx_n_s__area)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__area)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(7, 0, 43, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__histogram2d, 194, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is a quiet NaN. */ memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN)); PyEval_InitThreads(); if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC inithistogram(void); /*proto*/ PyMODINIT_FUNC inithistogram(void) #else PyMODINIT_FUNC PyInit_histogram(void); /*proto*/ PyMODINIT_FUNC PyInit_histogram(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_histogram(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("histogram"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_histogram) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "histogram.pyx":32 * from cython.parallel cimport prange * cimport numpy * import numpy # <<<<<<<<<<<<<< * cdef extern from "omp.h": * ctypedef struct omp_lock_t: */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 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__numpy, __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; /* "histogram.pyx":69 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram(numpy.ndarray pos not None, \ # <<<<<<<<<<<<<< * numpy.ndarray weights not None, \ * long bins=100, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9histogram_histogram, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histogram, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "histogram.pyx":198 * bins not None, * numpy.ndarray weights not None, * split=True, # <<<<<<<<<<<<<< * nthread=None, * double dummy=0.0): */ __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_3 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "histogram.pyx":194 * @cython.boundscheck(False) * @cython.wraparound(False) * def histogram2d(numpy.ndarray pos0 not None, # <<<<<<<<<<<<<< * numpy.ndarray pos1 not None, * bins not None, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9histogram_1histogram2d, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histogram2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "histogram.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # -*- coding: utf8 -*- * # */ __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; /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init histogram"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; int is_complex; char enc_type; char new_packmode; char enc_packmode; } __Pyx_BufFmt_Context; static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'b': return "'char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset; if (ctx->enc_type == 0) return 0; group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } __Pyx_BufFmt_RaiseExpected(ctx); return -1; } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; --ctx->enc_count; /* Consume from buffer string */ /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; } break; case '}': /* end of substruct; either repeat or move on */ ++ts; return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; default: { int number = __Pyx_BufFmt_ParseNumber(&ts); if (number == -1) { /* First char was not a digit */ PyErr_Format(PyExc_ValueError, "Does not understand character buffer dtype format string ('%c')", *ts); return NULL; } ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; PyErr_NormalizeException(&local_type, &local_value, &local_tb); if (unlikely(tstate->curexc_type)) goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif *type = local_type; *value = local_value; *tb = local_tb; Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); else { PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject* obj = view->obj; if (obj) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); Py_DECREF(obj); view->obj = NULL; } } #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pyfai-0.3.5/src/bilinear.pyx0000644001611600065110000000754711703641247015141 0ustar kieffersoft# -*- coding: utf8 -*- # # Project: Azimuthal integration # https://forge.epn-campus.eu/projects/azimuthal # # File: "$Id$" # # Copyright (C) European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # __author__ = "Jerome Kieffer" __license__ = "GPLv3" __date__ = "21/12/2011" __copyright__ = "2011, ESRF" __contact__ = "jerome.kieffer@esrf.fr" import cython cimport numpy import numpy ctypedef numpy.float32_t DTYPE_float32_t cdef extern from "math.h": float floor(float) nogil float ceil(float) nogil cdef extern from "stdlib.h": void free(void * ptr)nogil void * calloc(size_t nmemb, size_t size)nogil void * malloc(size_t size)nogil void * memcpy(void * dst, void * src, long n) cdef extern from "numpy/arrayobject.h": ctypedef int intp ctypedef extern class numpy.ndarray [object PyArrayObject]: cdef char * data cdef int nd cdef intp * dimensions cdef intp * strides cdef int flags @cython.boundscheck(False) cdef class bilinear: """Bilinear interpolator for finding max""" cdef float * data cdef float max, min cdef long d0_max, d1_max, r def __dealloc__(self): free(self.data) def __init__(self, numpy.ndarray data not None): assert data.ndim == 2 self.d0_max = data.shape[0] - 1 self.d1_max = data.shape[1] - 1 self.r = data.shape[1] self.max = data.max() self.min = data.min() self.data = < float *> malloc(data.size * sizeof(float)) cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] data2 = numpy.ascontiguousarray(data.astype("float32")) memcpy(self.data, data2.data, data.size * sizeof(float)) def f_cy(self, x): """ Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates @param x: 2-tuple of float @return: Interpolated signal from the image (negative for minimizer) """ cdef float d0 = x[0] cdef float d1 = x[1] cdef int i0, i1, j0, j1 cdef float x0, x1, y0, y1, res x0 = floor(d0) x1 = ceil(d0) y0 = floor(d1) y1 = ceil(d1) i0 = < int > x0 i1 = < int > x1 j0 = < int > y0 j1 = < int > y1 if d0 < 0: res = self.min + d0 elif d1 < 0: res = self.min + d1 elif d0 > self.d0_max: res = self.min - d0 + self.d0_max elif d1 > self.d1_max: res = self.min - d1 + self.d1_max elif (i0 == i1) and (j0 == j1): res = self.data[i0 * self.r + j0] elif i0 == i1: res = (self.data[i0 * self.r + j0] * (y1 - d1)) + (self.data[i0 * self.r + j1] * (d1 - y0)) elif j0 == j1: res = (self.data[i0 * self.r + j0] * (x1 - d0)) + (self.data[i1 * self.r + j0] * (d0 - x0)) else: res = (self.data[i0 * self.r + j0] * (x1 - d0) * (y1 - d1)) \ + (self.data[i1 * self.r + j0] * (d0 - x0) * (y1 - d1)) \ + (self.data[i0 * self.r + j1] * (x1 - d0) * (d1 - y0)) \ + (self.data[i1 * self.r + j1] * (d0 - x0) * (d1 - y0)) return - res pyfai-0.3.5/src/histogram.html0000644001611600065110000132502411655233320015462 0ustar kieffersoft

Generated by Cython 0.15.1+ on Sat Nov 5 14:14:56 2011

Raw output: histogram.c

 1: #!/usr/bin/env python
  /* "histogram.pyx":1
 * #!/usr/bin/env python             # <<<<<<<<<<<<<<
 * # -*- coding: utf8 -*-
 * #
 */
  __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: utf8 -*-
 3: #
 4: #    Project: Azimuthal integration
 5: #             https://forge.epn-campus.eu/projects/azimuthal
 6: #
 7: #    File: "$Id$"
 8: #
 9: #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
 10: #
 11: #    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
 12: #
 13: #    This program is free software: you can redistribute it and/or modify
 14: #    it under the terms of the GNU General Public License as published by
 15: #    the Free Software Foundation, either version 3 of the License, or
 16: #    (at your option) any later version.
 17: #
 18: #    This program is distributed in the hope that it will be useful,
 19: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21: #    GNU General Public License for more details.
 22: #
 23: #    You should have received a copy of the GNU General Public License
 24: #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 25: #
 26: 
 27: 
 28: 
 29: import cython
 30: from cython.parallel cimport prange
 31: cimport numpy
 32: import numpy
  /* "histogram.pyx":32
 * from cython.parallel cimport prange
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * cdef extern from "omp.h":
 *     ctypedef struct omp_lock_t:
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 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__numpy, __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: cdef extern from "omp.h":
 34:     ctypedef struct omp_lock_t:
 35:         pass
 36: 
 37:     extern void omp_set_num_threads(int) nogil
 38:     extern int omp_get_num_threads() nogil
 39:     extern int omp_get_max_threads() nogil
 40:     extern int omp_get_thread_num() nogil
 41:     extern int omp_get_num_procs() nogil
 42: 
 43:     extern int omp_in_parallel() nogil
 44:     extern void omp_init_lock(omp_lock_t *) nogil
 45:     extern void omp_destroy_lock(omp_lock_t *) nogil
 46:     extern void omp_set_lock(omp_lock_t *) nogil
 47:     extern void omp_unset_lock(omp_lock_t *) nogil
 48:     extern int omp_test_lock(omp_lock_t *) nogil
 49: 
 50: 
 51: cdef extern from "stdlib.h":
 52:     void free(void * ptr)nogil
 53:     void * calloc(size_t nmemb, size_t size)nogil
 54:     void * malloc(size_t size)nogil
 55: cdef extern from "math.h":
 56:     double floor(double)nogil
 57:     double  fabs(double)nogil
 58:     int     isnan(double)
 59: 
 60: # "ctypedef" assigns a corresponding compile-time type to DTYPE_t. For
 61: # every type in the numpy module there's a corresponding compile-time
 62: # type with a _t-suffix.
 63: ctypedef numpy.int64_t DTYPE_int64_t
/* "histogram.pyx":63
 * # every type in the numpy module there's a corresponding compile-time
 * # type with a _t-suffix.
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_9histogram_DTYPE_int64_t;
 64: ctypedef numpy.float64_t DTYPE_float64_t
 65: 
 66: @cython.cdivision(True)
 67: @cython.boundscheck(False)
 68: @cython.wraparound(False)
 69: def histogram(numpy.ndarray pos not None, \
/* "histogram.pyx":69
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram(numpy.ndarray pos not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None, \
 *               long bins=100,
 */

static PyObject *__pyx_pf_9histogram_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9histogram_histogram[] = "\n    Calculates histogram of pos weighted by weights\n    \n    @param pos: 2Theta array\n    @param weights: array with intensities\n    @param bins: number of output bins\n    @param pixelSize_in_Pos: size of a pixels in 2theta\n    @param nthread: maximum number of thread to use. By default: maximum available. \n        One can also limit this with OMP_NUM_THREADS environment variable\n        \n    @return 2theta, I, weighted histogram, raw histogram\n    ";
static PyMethodDef __pyx_mdef_9histogram_histogram = {__Pyx_NAMESTR("histogram"), (PyCFunction)__pyx_pf_9histogram_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9histogram_histogram)};
static PyObject *__pyx_pf_9histogram_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pos = 0;
  PyArrayObject *__pyx_v_weights = 0;
  long __pyx_v_bins;
  PyObject *__pyx_v_bin_range = 0;
  PyObject *__pyx_v_pixelSize_in_Pos = 0;
  PyObject *__pyx_v_nthread = 0;
  double __pyx_v_dummy;
  long __pyx_v_size;
  PyArrayObject *__pyx_v_cpos = 0;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_outPos = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_temp = 0;
  double __pyx_v_bin_edge_min;
  double __pyx_v_bin_edge_max;
  double __pyx_v_bin_width;
  double __pyx_v_inv_bin_width;
  double __pyx_v_a;
  double __pyx_v_d;
  double __pyx_v_fbin;
  double __pyx_v_ffbin;
  double __pyx_v_dInt;
  double __pyx_v_dIntR;
  double __pyx_v_dIntL;
  CYTHON_UNUSED double __pyx_v_dTmp;
  double __pyx_v_dbin;
  double __pyx_v_inv_dbin2;
  double __pyx_v_tmp_count;
  double __pyx_v_tmp_data;
  double __pyx_v_epsilon;
  long __pyx_v_bin;
  long __pyx_v_i;
  long __pyx_v_idx;
  long __pyx_v_t;
  long __pyx_v_dest;
  double *__pyx_v_bigCount;
  double *__pyx_v_bigData;
  double __pyx_v_dtmp;
  Py_buffer __pyx_bstruct_outPos;
  Py_ssize_t __pyx_bstride_0_outPos = 0;
  Py_ssize_t __pyx_bshape_0_outPos = 0;
  Py_buffer __pyx_bstruct_outMerge;
  Py_ssize_t __pyx_bstride_0_outMerge = 0;
  Py_ssize_t __pyx_bshape_0_outMerge = 0;
  Py_buffer __pyx_bstruct_outCount;
  Py_ssize_t __pyx_bstride_0_outCount = 0;
  Py_ssize_t __pyx_bshape_0_outCount = 0;
  Py_buffer __pyx_bstruct_cdata;
  Py_ssize_t __pyx_bstride_0_cdata = 0;
  Py_ssize_t __pyx_bshape_0_cdata = 0;
  Py_buffer __pyx_bstruct_cpos;
  Py_ssize_t __pyx_bstride_0_cpos = 0;
  Py_ssize_t __pyx_bshape_0_cpos = 0;
  Py_buffer __pyx_bstruct_temp;
  Py_ssize_t __pyx_bstride_0_temp = 0;
  Py_ssize_t __pyx_bshape_0_temp = 0;
  Py_buffer __pyx_bstruct_outData;
  Py_ssize_t __pyx_bstride_0_outData = 0;
  Py_ssize_t __pyx_bshape_0_outData = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__bin_range,&__pyx_n_s__pixelSize_in_Pos,&__pyx_n_s__nthread,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram");
  __pyx_self = __pyx_self;
  {
    PyObject* values[7] = {0,0,0,0,0,0,0};

  /* "histogram.pyx":69
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram(numpy.ndarray pos not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None, \
 *               long bins=100,
 */
  __pyx_k_tuple_19 = PyTuple_New(40); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_range));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__bin_range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pixelSize_in_Pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__pixelSize_in_Pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pixelSize_in_Pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nthread));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__nthread));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nthread));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__cpos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__temp));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__temp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__temp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_edge_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__bin_edge_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_edge_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_edge_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__bin_edge_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_edge_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin_width));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 17, ((PyObject *)__pyx_n_s__bin_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_width));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__inv_bin_width));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 18, ((PyObject *)__pyx_n_s__inv_bin_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inv_bin_width));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 19, ((PyObject *)__pyx_n_s__a));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 20, ((PyObject *)__pyx_n_s__d));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 21, ((PyObject *)__pyx_n_s__fbin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ffbin));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 22, ((PyObject *)__pyx_n_s__ffbin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ffbin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dInt));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 23, ((PyObject *)__pyx_n_s__dInt));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dInt));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dIntR));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 24, ((PyObject *)__pyx_n_s__dIntR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dIntR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dIntL));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 25, ((PyObject *)__pyx_n_s__dIntL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dIntL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dTmp));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 26, ((PyObject *)__pyx_n_s__dTmp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dTmp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 27, ((PyObject *)__pyx_n_s__dbin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__inv_dbin2));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 28, ((PyObject *)__pyx_n_s__inv_dbin2));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inv_dbin2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 29, ((PyObject *)__pyx_n_s__tmp_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp_data));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 30, ((PyObject *)__pyx_n_s__tmp_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp_data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 31, ((PyObject *)__pyx_n_s__epsilon));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 32, ((PyObject *)__pyx_n_s__bin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 33, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 34, ((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_19, 35, ((PyObject *)__pyx_n_s__t));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dest));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 36, ((PyObject *)__pyx_n_s__dest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bigCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 37, ((PyObject *)__pyx_n_s__bigCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bigData));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 38, ((PyObject *)__pyx_n_s__bigData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dtmp));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 39, ((PyObject *)__pyx_n_s__dtmp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dtmp));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "histogram.pyx":69
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram(numpy.ndarray pos not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None, \
 *               long bins=100,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9histogram_histogram, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histogram, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(7, 0, 40, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__histogram, 69, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 70:               numpy.ndarray weights not None, \
 71:               long bins=100,
 72:               bin_range=None,
    /* "histogram.pyx":72
 *               numpy.ndarray weights not None, \
 *               long bins=100,
 *               bin_range=None,             # <<<<<<<<<<<<<<
 *               pixelSize_in_Pos=None,
 *               nthread=None,
 */
    values[3] = ((PyObject *)Py_None);
 73:               pixelSize_in_Pos=None,
    /* "histogram.pyx":73
 *               long bins=100,
 *               bin_range=None,
 *               pixelSize_in_Pos=None,             # <<<<<<<<<<<<<<
 *               nthread=None,
 *               double dummy=0.0):
 */
    values[4] = ((PyObject *)Py_None);
 74:               nthread=None,
    /* "histogram.pyx":74
 *               bin_range=None,
 *               pixelSize_in_Pos=None,
 *               nthread=None,             # <<<<<<<<<<<<<<
 *               double dummy=0.0):
 *     """
 */
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histogram", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bin_range);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pixelSize_in_Pos);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nthread);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pos = ((PyArrayObject *)values[0]);
    __pyx_v_weights = ((PyArrayObject *)values[1]);
    if (values[2]) {
      __pyx_v_bins = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_bins = ((long)100);
    }
    __pyx_v_bin_range = values[3];
    __pyx_v_pixelSize_in_Pos = values[4];
    __pyx_v_nthread = values[5];
    if (values[6]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
 75:               double dummy=0.0):
      /* "histogram.pyx":75
 *               pixelSize_in_Pos=None,
 *               nthread=None,
 *               double dummy=0.0):             # <<<<<<<<<<<<<<
 *     """
 *     Calculates histogram of pos weighted by weights
 */
      __pyx_v_dummy = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("histogram.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_cpos.buf = NULL;
  __pyx_bstruct_cdata.buf = NULL;
  __pyx_bstruct_outData.buf = NULL;
  __pyx_bstruct_outCount.buf = NULL;
  __pyx_bstruct_outMerge.buf = NULL;
  __pyx_bstruct_outPos.buf = NULL;
  __pyx_bstruct_temp.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 76:     """
 77:     Calculates histogram of pos weighted by weights
 78: 
 79:     @param pos: 2Theta array
 80:     @param weights: array with intensities
 81:     @param bins: number of output bins
 82:     @param pixelSize_in_Pos: size of a pixels in 2theta
 83:     @param nthread: maximum number of thread to use. By default: maximum available.
 84:         One can also limit this with OMP_NUM_THREADS environment variable
 85: 
 86:     @return 2theta, I, weighted histogram, raw histogram
 87:     """
 88: 
 89:     assert pos.size == weights.size
  /* "histogram.pyx":89
 *     """
 * 
 *     assert pos.size == weights.size             # <<<<<<<<<<<<<<
 *     assert  bins > 1
 *     cdef long  size = pos.size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 90:     assert  bins > 1
  /* "histogram.pyx":90
 * 
 *     assert pos.size == weights.size
 *     assert  bins > 1             # <<<<<<<<<<<<<<
 *     cdef long  size = pos.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_bins > 1))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 91:     cdef long  size = pos.size
  /* "histogram.pyx":91
 *     assert pos.size == weights.size
 *     assert  bins > 1
 *     cdef long  size = pos.size             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_size = __pyx_t_5;
 92:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
  /* "histogram.pyx":92
 *     assert  bins > 1
 *     cdef long  size = pos.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0];
      __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_cpos = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "histogram.pyx":92
 *     assert  bins > 1
 *     cdef long  size = pos.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 93:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
  /* "histogram.pyx":93
 *     cdef long  size = pos.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __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_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0];
      __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "histogram.pyx":93
 *     cdef long  size = pos.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 94:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
  /* "histogram.pyx":94
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0];
      __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
 95:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
  /* "histogram.pyx":95
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0];
      __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 96:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
  /* "histogram.pyx":96
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0];
      __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 97:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
  /* "histogram.pyx":97
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
 *     cdef double bin_edge_min = pos.min()
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outPos, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outPos.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outPos = __pyx_bstruct_outPos.strides[0];
      __pyx_bshape_0_outPos = __pyx_bstruct_outPos.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_outPos = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
 98:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
  /* "histogram.pyx":98
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef double bin_edge_min = pos.min()
 *     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong((__pyx_v_size - 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_temp.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_temp = __pyx_bstruct_temp.strides[0];
      __pyx_bshape_0_temp = __pyx_bstruct_temp.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_temp = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 99:     cdef double bin_edge_min = pos.min()
  /* "histogram.pyx":99
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
 *     cdef double bin_edge_min = pos.min()             # <<<<<<<<<<<<<<
 *     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
 *     if bin_range is not None:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bin_edge_min = __pyx_t_14;
 100:     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
  /* "histogram.pyx":100
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
 *     cdef double bin_edge_min = pos.min()
 *     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 *     if bin_range is not None:
 *         bin_edge_min = bin_range[0]
 */
  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__max); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__double); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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_8)); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bin_edge_max = __pyx_t_14;
 101:     if bin_range is not None:
  /* "histogram.pyx":101
 *     cdef double bin_edge_min = pos.min()
 *     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
 *     if bin_range is not None:             # <<<<<<<<<<<<<<
 *         bin_edge_min = bin_range[0]
 *         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
 */
  __pyx_t_4 = (__pyx_v_bin_range != Py_None);
  if (__pyx_t_4) {
 102:         bin_edge_min = bin_range[0]
    /* "histogram.pyx":102
 *     cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
 *     if bin_range is not None:
 *         bin_edge_min = bin_range[0]             # <<<<<<<<<<<<<<
 *         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
 */
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_bin_range, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_bin_edge_min = __pyx_t_14;
 103:         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
    /* "histogram.pyx":103
 *     if bin_range is not None:
 *         bin_edge_min = bin_range[0]
 *         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
 *     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
 */
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_bin_range, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_bin_edge_max = __pyx_t_14;
    goto __pyx_L6;
  }
  __pyx_L6:;
 104:     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
  /* "histogram.pyx":104
 *         bin_edge_min = bin_range[0]
 *         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))             # <<<<<<<<<<<<<<
 *     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
 *     cdef double a = 0.0
 */
  __pyx_v_bin_width = ((__pyx_v_bin_edge_max - __pyx_v_bin_edge_min) / ((double)__pyx_v_bins));
 105:     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
  /* "histogram.pyx":105
 *         bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
 *     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)             # <<<<<<<<<<<<<<
 *     cdef double a = 0.0
 *     cdef double d = 0.0
 */
  __pyx_v_inv_bin_width = (((double)__pyx_v_bins) / (__pyx_v_bin_edge_max - __pyx_v_bin_edge_min));
 106:     cdef double a = 0.0
  /* "histogram.pyx":106
 *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
 *     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
 *     cdef double a = 0.0             # <<<<<<<<<<<<<<
 *     cdef double d = 0.0
 *     cdef double fbin = 0.0
 */
  __pyx_v_a = 0.0;
 107:     cdef double d = 0.0
  /* "histogram.pyx":107
 *     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
 *     cdef double a = 0.0
 *     cdef double d = 0.0             # <<<<<<<<<<<<<<
 *     cdef double fbin = 0.0
 *     cdef double ffbin = 0.0
 */
  __pyx_v_d = 0.0;
 108:     cdef double fbin = 0.0
  /* "histogram.pyx":108
 *     cdef double a = 0.0
 *     cdef double d = 0.0
 *     cdef double fbin = 0.0             # <<<<<<<<<<<<<<
 *     cdef double ffbin = 0.0
 *     cdef double dInt = 0.0
 */
  __pyx_v_fbin = 0.0;
 109:     cdef double ffbin = 0.0
  /* "histogram.pyx":109
 *     cdef double d = 0.0
 *     cdef double fbin = 0.0
 *     cdef double ffbin = 0.0             # <<<<<<<<<<<<<<
 *     cdef double dInt = 0.0
 *     cdef double dIntR = 0.0
 */
  __pyx_v_ffbin = 0.0;
 110:     cdef double dInt = 0.0
  /* "histogram.pyx":110
 *     cdef double fbin = 0.0
 *     cdef double ffbin = 0.0
 *     cdef double dInt = 0.0             # <<<<<<<<<<<<<<
 *     cdef double dIntR = 0.0
 *     cdef double dIntL = 0.0
 */
  __pyx_v_dInt = 0.0;
 111:     cdef double dIntR = 0.0
  /* "histogram.pyx":111
 *     cdef double ffbin = 0.0
 *     cdef double dInt = 0.0
 *     cdef double dIntR = 0.0             # <<<<<<<<<<<<<<
 *     cdef double dIntL = 0.0
 *     cdef double dTmp = 0.0
 */
  __pyx_v_dIntR = 0.0;
 112:     cdef double dIntL = 0.0
  /* "histogram.pyx":112
 *     cdef double dInt = 0.0
 *     cdef double dIntR = 0.0
 *     cdef double dIntL = 0.0             # <<<<<<<<<<<<<<
 *     cdef double dTmp = 0.0
 *     cdef double dbin, inv_dbin2 = 0.0
 */
  __pyx_v_dIntL = 0.0;
 113:     cdef double dTmp = 0.0
  /* "histogram.pyx":113
 *     cdef double dIntR = 0.0
 *     cdef double dIntL = 0.0
 *     cdef double dTmp = 0.0             # <<<<<<<<<<<<<<
 *     cdef double dbin, inv_dbin2 = 0.0
 *     cdef double tmp_count, tmp_data = 0.0
 */
  __pyx_v_dTmp = 0.0;
 114:     cdef double dbin, inv_dbin2 = 0.0
  /* "histogram.pyx":114
 *     cdef double dIntL = 0.0
 *     cdef double dTmp = 0.0
 *     cdef double dbin, inv_dbin2 = 0.0             # <<<<<<<<<<<<<<
 *     cdef double tmp_count, tmp_data = 0.0
 *     cdef double epsilon = 1e-10
 */
  __pyx_v_inv_dbin2 = 0.0;
 115:     cdef double tmp_count, tmp_data = 0.0
  /* "histogram.pyx":115
 *     cdef double dTmp = 0.0
 *     cdef double dbin, inv_dbin2 = 0.0
 *     cdef double tmp_count, tmp_data = 0.0             # <<<<<<<<<<<<<<
 *     cdef double epsilon = 1e-10
 * 
 */
  __pyx_v_tmp_data = 0.0;
 116:     cdef double epsilon = 1e-10
  /* "histogram.pyx":116
 *     cdef double dbin, inv_dbin2 = 0.0
 *     cdef double tmp_count, tmp_data = 0.0
 *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
 * 
 *     cdef long   bin = 0
 */
  __pyx_v_epsilon = 1e-10;
 117: 
 118:     cdef long   bin = 0
  /* "histogram.pyx":118
 *     cdef double epsilon = 1e-10
 * 
 *     cdef long   bin = 0             # <<<<<<<<<<<<<<
 *     cdef long   i, idx, t, dest = 0
 *     if nthread is not None:
 */
  __pyx_v_bin = 0;
 119:     cdef long   i, idx, t, dest = 0
  /* "histogram.pyx":119
 * 
 *     cdef long   bin = 0
 *     cdef long   i, idx, t, dest = 0             # <<<<<<<<<<<<<<
 *     if nthread is not None:
 *         if isinstance(nthread, int) and (nthread > 0):
 */
  __pyx_v_dest = 0;
 120:     if nthread is not None:
  /* "histogram.pyx":120
 *     cdef long   bin = 0
 *     cdef long   i, idx, t, dest = 0
 *     if nthread is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)
 */
  __pyx_t_4 = (__pyx_v_nthread != Py_None);
  if (__pyx_t_4) {
 121:         if isinstance(nthread, int) and (nthread > 0):
    /* "histogram.pyx":121
 *     cdef long   i, idx, t, dest = 0
 *     if nthread is not None:
 *         if isinstance(nthread, int) and (nthread > 0):             # <<<<<<<<<<<<<<
 *             omp_set_num_threads(< int > nthread)
 * 
 */
    __pyx_t_3 = ((PyObject *)((PyObject*)(&PyInt_Type)));
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_nthread, __pyx_t_3); 
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_4;
    }
    if (__pyx_t_16) {
 122:             omp_set_num_threads(< int > nthread)
      /* "histogram.pyx":122
 *     if nthread is not None:
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)             # <<<<<<<<<<<<<<
 * 
 *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 */
      __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_nthread); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      omp_set_num_threads(((int)__pyx_t_17));
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;
 123: 
 124:     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
  /* "histogram.pyx":124
 *             omp_set_num_threads(< int > nthread)
 * 
 *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))             # <<<<<<<<<<<<<<
 *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 *     if pixelSize_in_Pos is None:
 */
  __pyx_v_bigCount = ((double *)calloc((__pyx_v_bins * omp_get_max_threads()), (sizeof(double))));
 125:     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
  /* "histogram.pyx":125
 * 
 *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))             # <<<<<<<<<<<<<<
 *     if pixelSize_in_Pos is None:
 *         dbin = 0.5
 */
  __pyx_v_bigData = ((double *)calloc((__pyx_v_bins * omp_get_max_threads()), (sizeof(double))));
 126:     if pixelSize_in_Pos is None:
  /* "histogram.pyx":126
 *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 *     if pixelSize_in_Pos is None:             # <<<<<<<<<<<<<<
 *         dbin = 0.5
 *         inv_dbin2 = 4.0
 */
  __pyx_t_16 = (__pyx_v_pixelSize_in_Pos == Py_None);
  if (__pyx_t_16) {
 127:         dbin = 0.5
    /* "histogram.pyx":127
 *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
 *     if pixelSize_in_Pos is None:
 *         dbin = 0.5             # <<<<<<<<<<<<<<
 *         inv_dbin2 = 4.0
 *     elif isinstance(pixelSize_in_Pos, (int, float)):
 */
    __pyx_v_dbin = 0.5;
 128:         inv_dbin2 = 4.0
    /* "histogram.pyx":128
 *     if pixelSize_in_Pos is None:
 *         dbin = 0.5
 *         inv_dbin2 = 4.0             # <<<<<<<<<<<<<<
 *     elif isinstance(pixelSize_in_Pos, (int, float)):
 *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
 */
    __pyx_v_inv_dbin2 = 4.0;
    goto __pyx_L9;
  }
 129:     elif isinstance(pixelSize_in_Pos, (int, float)):
  /* "histogram.pyx":129
 *         dbin = 0.5
 *         inv_dbin2 = 4.0
 *     elif isinstance(pixelSize_in_Pos, (int, float)):             # <<<<<<<<<<<<<<
 *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
 *         if dbin > 0.0:
 */
  __Pyx_INCREF(__pyx_v_pixelSize_in_Pos);
  __pyx_t_3 = __pyx_v_pixelSize_in_Pos;
  __pyx_t_16 = PyInt_Check(__pyx_t_3); 
  if (!__pyx_t_16) {
    __pyx_t_4 = PyFloat_Check(__pyx_t_3); 
    __pyx_t_15 = __pyx_t_4;
  } else {
    __pyx_t_15 = __pyx_t_16;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_15) {
 130:         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
    /* "histogram.pyx":130
 *         inv_dbin2 = 4.0
 *     elif isinstance(pixelSize_in_Pos, (int, float)):
 *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width             # <<<<<<<<<<<<<<
 *         if dbin > 0.0:
 *             inv_dbin2 = 1 / dbin / dbin
 */
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_pixelSize_in_Pos); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_dbin = ((0.5 * ((double)__pyx_t_14)) * __pyx_v_inv_bin_width);
 131:         if dbin > 0.0:
    /* "histogram.pyx":131
 *     elif isinstance(pixelSize_in_Pos, (int, float)):
 *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
 *         if dbin > 0.0:             # <<<<<<<<<<<<<<
 *             inv_dbin2 = 1 / dbin / dbin
 *         else:
 */
    __pyx_t_15 = (__pyx_v_dbin > 0.0);
    if (__pyx_t_15) {
 132:             inv_dbin2 = 1 / dbin / dbin
      /* "histogram.pyx":132
 *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
 *         if dbin > 0.0:
 *             inv_dbin2 = 1 / dbin / dbin             # <<<<<<<<<<<<<<
 *         else:
 *             inv_dbin2 = 0.0
 */
      __pyx_v_inv_dbin2 = ((1.0 / __pyx_v_dbin) / __pyx_v_dbin);
      goto __pyx_L10;
    }
    /*else*/ {
 133:         else:
 134:             inv_dbin2 = 0.0
      /* "histogram.pyx":134
 *             inv_dbin2 = 1 / dbin / dbin
 *         else:
 *             inv_dbin2 = 0.0             # <<<<<<<<<<<<<<
 *     elif isinstance(pixelSize_in_Pos, numpy.ndarray):
 *         pass #TODO
 */
      __pyx_v_inv_dbin2 = 0.0;
    }
    __pyx_L10:;
    goto __pyx_L9;
  }
 135:     elif isinstance(pixelSize_in_Pos, numpy.ndarray):
  /* "histogram.pyx":135
 *         else:
 *             inv_dbin2 = 0.0
 *     elif isinstance(pixelSize_in_Pos, numpy.ndarray):             # <<<<<<<<<<<<<<
 *         pass #TODO
 * 
 */
  __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_15 = __Pyx_TypeCheck(__pyx_v_pixelSize_in_Pos, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_15) {
    goto __pyx_L9;
  }
  __pyx_L9:;
 136:         pass #TODO
 137: 
 138:     if isnan(dbin) or isnan(inv_dbin2):
  /* "histogram.pyx":138
 *         pass #TODO
 * 
 *     if isnan(dbin) or isnan(inv_dbin2):             # <<<<<<<<<<<<<<
 *         dbin = 0.0
 *         inv_dbin2 = 0.0
 */
  __pyx_t_17 = isnan(__pyx_v_dbin);
  if (!__pyx_t_17) {
    __pyx_t_18 = isnan(__pyx_v_inv_dbin2);
    __pyx_t_15 = __pyx_t_18;
  } else {
    __pyx_t_15 = __pyx_t_17;
  }
  if (__pyx_t_15) {
 139:         dbin = 0.0
    /* "histogram.pyx":139
 * 
 *     if isnan(dbin) or isnan(inv_dbin2):
 *         dbin = 0.0             # <<<<<<<<<<<<<<
 *         inv_dbin2 = 0.0
 * 
 */
    __pyx_v_dbin = 0.0;
 140:         inv_dbin2 = 0.0
    /* "histogram.pyx":140
 *     if isnan(dbin) or isnan(inv_dbin2):
 *         dbin = 0.0
 *         inv_dbin2 = 0.0             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __pyx_v_inv_dbin2 = 0.0;
    goto __pyx_L11;
  }
  __pyx_L11:;
 141: 
 142:     with nogil:
  /* "histogram.pyx":142
 *         inv_dbin2 = 0.0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(size):
 *             d = cdata[i]
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "histogram.pyx":142
 *         inv_dbin2 = 0.0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(size):
 *             d = cdata[i]
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
  }
 143:         for i in prange(size):
        /* "histogram.pyx":143
 * 
 *     with nogil:
 *         for i in prange(size):             # <<<<<<<<<<<<<<
 *             d = cdata[i]
 *             a = cpos[i]
 */
        __pyx_t_5 = __pyx_v_size;
        if (1 == 0) abort();
        {
            __pyx_t_20 = (__pyx_t_5 - 0) / 1;
            if (__pyx_t_20 > 0)
            {
                __pyx_v_i = 0;
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_dest) lastprivate(__pyx_v_dIntL) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_dIntR) lastprivate(__pyx_v_bin) lastprivate(__pyx_v_dtmp) lastprivate(__pyx_v_a) lastprivate(__pyx_v_ffbin) lastprivate(__pyx_v_d) lastprivate(__pyx_v_fbin) lastprivate(__pyx_v_dInt)
                    #endif /* _OPENMP */
                    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_20; __pyx_t_19++){
                        {
                            __pyx_v_i = 0 + 1 * __pyx_t_19;
                            /* Initialize private variables to invalid values */
                            __pyx_v_dest = ((long)0xbad0bad0);
                            __pyx_v_dIntL = ((double)__PYX_NAN);
                            __pyx_v_dIntR = ((double)__PYX_NAN);
                            __pyx_v_bin = ((long)0xbad0bad0);
                            __pyx_v_dtmp = ((double)__PYX_NAN);
                            __pyx_v_a = ((double)__PYX_NAN);
                            __pyx_v_ffbin = ((double)__PYX_NAN);
                            __pyx_v_d = ((double)__PYX_NAN);
                            __pyx_v_fbin = ((double)__PYX_NAN);
                            __pyx_v_dInt = ((double)__PYX_NAN);
 144:             d = cdata[i]
                            /* "histogram.pyx":144
 *     with nogil:
 *         for i in prange(size):
 *             d = cdata[i]             # <<<<<<<<<<<<<<
 *             a = cpos[i]
 *             if (a < bin_edge_min) or (a > bin_edge_max):
 */
                            __pyx_t_21 = __pyx_v_i;
                            __pyx_v_d = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_21, __pyx_bstride_0_cdata));
 145:             a = cpos[i]
                            /* "histogram.pyx":145
 *         for i in prange(size):
 *             d = cdata[i]
 *             a = cpos[i]             # <<<<<<<<<<<<<<
 *             if (a < bin_edge_min) or (a > bin_edge_max):
 *                 continue
 */
                            __pyx_t_22 = __pyx_v_i;
                            __pyx_v_a = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_22, __pyx_bstride_0_cpos));
 146:             if (a < bin_edge_min) or (a > bin_edge_max):
                            /* "histogram.pyx":146
 *             d = cdata[i]
 *             a = cpos[i]
 *             if (a < bin_edge_min) or (a > bin_edge_max):             # <<<<<<<<<<<<<<
 *                 continue
 *             fbin = (a - bin_edge_min) * inv_bin_width
 */
                            __pyx_t_15 = (__pyx_v_a < __pyx_v_bin_edge_min);
                            if (!__pyx_t_15) {
                              __pyx_t_16 = (__pyx_v_a > __pyx_v_bin_edge_max);
                              __pyx_t_4 = __pyx_t_16;
                            } else {
                              __pyx_t_4 = __pyx_t_15;
                            }
                            if (__pyx_t_4) {
 147:                 continue
                              /* "histogram.pyx":147
 *             a = cpos[i]
 *             if (a < bin_edge_min) or (a > bin_edge_max):
 *                 continue             # <<<<<<<<<<<<<<
 *             fbin = (a - bin_edge_min) * inv_bin_width
 *             ffbin = floor(fbin)
 */
                              goto __pyx_L15_continue;
                              goto __pyx_L19;
                            }
                            __pyx_L19:;
 148:             fbin = (a - bin_edge_min) * inv_bin_width
                            /* "histogram.pyx":148
 *             if (a < bin_edge_min) or (a > bin_edge_max):
 *                 continue
 *             fbin = (a - bin_edge_min) * inv_bin_width             # <<<<<<<<<<<<<<
 *             ffbin = floor(fbin)
 *             bin = < long > ffbin
 */
                            __pyx_v_fbin = ((__pyx_v_a - __pyx_v_bin_edge_min) * __pyx_v_inv_bin_width);
 149:             ffbin = floor(fbin)
                            /* "histogram.pyx":149
 *                 continue
 *             fbin = (a - bin_edge_min) * inv_bin_width
 *             ffbin = floor(fbin)             # <<<<<<<<<<<<<<
 *             bin = < long > ffbin
 *             dest = omp_get_thread_num() * bins + bin
 */
                            __pyx_v_ffbin = floor(__pyx_v_fbin);
 150:             bin = < long > ffbin
                            /* "histogram.pyx":150
 *             fbin = (a - bin_edge_min) * inv_bin_width
 *             ffbin = floor(fbin)
 *             bin = < long > ffbin             # <<<<<<<<<<<<<<
 *             dest = omp_get_thread_num() * bins + bin
 *             dInt = 1.0
 */
                            __pyx_v_bin = ((long)__pyx_v_ffbin);
 151:             dest = omp_get_thread_num() * bins + bin
                            /* "histogram.pyx":151
 *             ffbin = floor(fbin)
 *             bin = < long > ffbin
 *             dest = omp_get_thread_num() * bins + bin             # <<<<<<<<<<<<<<
 *             dInt = 1.0
 *             if  bin > 0 :
 */
                            __pyx_v_dest = ((omp_get_thread_num() * __pyx_v_bins) + __pyx_v_bin);
 152:             dInt = 1.0
                            /* "histogram.pyx":152
 *             bin = < long > ffbin
 *             dest = omp_get_thread_num() * bins + bin
 *             dInt = 1.0             # <<<<<<<<<<<<<<
 *             if  bin > 0 :
 *                 dtmp = ffbin - (fbin - dbin)
 */
                            __pyx_v_dInt = 1.0;
 153:             if  bin > 0 :
                            /* "histogram.pyx":153
 *             dest = omp_get_thread_num() * bins + bin
 *             dInt = 1.0
 *             if  bin > 0 :             # <<<<<<<<<<<<<<
 *                 dtmp = ffbin - (fbin - dbin)
 *                 if dtmp > 0:
 */
                            __pyx_t_4 = (__pyx_v_bin > 0);
                            if (__pyx_t_4) {
 154:                 dtmp = ffbin - (fbin - dbin)
                              /* "histogram.pyx":154
 *             dInt = 1.0
 *             if  bin > 0 :
 *                 dtmp = ffbin - (fbin - dbin)             # <<<<<<<<<<<<<<
 *                 if dtmp > 0:
 *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
 */
                              __pyx_v_dtmp = (__pyx_v_ffbin - (__pyx_v_fbin - __pyx_v_dbin));
 155:                 if dtmp > 0:
                              /* "histogram.pyx":155
 *             if  bin > 0 :
 *                 dtmp = ffbin - (fbin - dbin)
 *                 if dtmp > 0:             # <<<<<<<<<<<<<<
 *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntL
 */
                              __pyx_t_4 = (__pyx_v_dtmp > 0.0);
                              if (__pyx_t_4) {
 156:                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
                                /* "histogram.pyx":156
 *                 dtmp = ffbin - (fbin - dbin)
 *                 if dtmp > 0:
 *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2             # <<<<<<<<<<<<<<
 *                     dInt = dInt - dIntL
 *                     bigCount[dest - 1] += dIntL
 */
                                __pyx_v_dIntL = (((0.5 * __pyx_v_dtmp) * __pyx_v_dtmp) * __pyx_v_inv_dbin2);
 157:                     dInt = dInt - dIntL
                                /* "histogram.pyx":157
 *                 if dtmp > 0:
 *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntL             # <<<<<<<<<<<<<<
 *                     bigCount[dest - 1] += dIntL
 *                     bigData[dest - 1] += d * dIntL
 */
                                __pyx_v_dInt = (__pyx_v_dInt - __pyx_v_dIntL);
 158:                     bigCount[dest - 1] += dIntL
                                /* "histogram.pyx":158
 *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntL
 *                     bigCount[dest - 1] += dIntL             # <<<<<<<<<<<<<<
 *                     bigData[dest - 1] += d * dIntL
 * 
 */
                                __pyx_t_23 = (__pyx_v_dest - 1);
                                (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dIntL);
 159:                     bigData[dest - 1] += d * dIntL
                                /* "histogram.pyx":159
 *                     dInt = dInt - dIntL
 *                     bigCount[dest - 1] += dIntL
 *                     bigData[dest - 1] += d * dIntL             # <<<<<<<<<<<<<<
 * 
 *             if bin < bins - 1 :
 */
                                __pyx_t_23 = (__pyx_v_dest - 1);
                                (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dIntL));
                                goto __pyx_L21;
                              }
                              __pyx_L21:;
                              goto __pyx_L20;
                            }
                            __pyx_L20:;
 160: 
 161:             if bin < bins - 1 :
                            /* "histogram.pyx":161
 *                     bigData[dest - 1] += d * dIntL
 * 
 *             if bin < bins - 1 :             # <<<<<<<<<<<<<<
 *                 dtmp = fbin + dbin - ffbin - 1
 *                 if dtmp > 0 :
 */
                            __pyx_t_4 = (__pyx_v_bin < (__pyx_v_bins - 1));
                            if (__pyx_t_4) {
 162:                 dtmp = fbin + dbin - ffbin - 1
                              /* "histogram.pyx":162
 * 
 *             if bin < bins - 1 :
 *                 dtmp = fbin + dbin - ffbin - 1             # <<<<<<<<<<<<<<
 *                 if dtmp > 0 :
 *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
 */
                              __pyx_v_dtmp = (((__pyx_v_fbin + __pyx_v_dbin) - __pyx_v_ffbin) - 1.0);
 163:                 if dtmp > 0 :
                              /* "histogram.pyx":163
 *             if bin < bins - 1 :
 *                 dtmp = fbin + dbin - ffbin - 1
 *                 if dtmp > 0 :             # <<<<<<<<<<<<<<
 *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntR
 */
                              __pyx_t_4 = (__pyx_v_dtmp > 0.0);
                              if (__pyx_t_4) {
 164:                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
                                /* "histogram.pyx":164
 *                 dtmp = fbin + dbin - ffbin - 1
 *                 if dtmp > 0 :
 *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2             # <<<<<<<<<<<<<<
 *                     dInt = dInt - dIntR
 *                     bigCount[dest + 1] += dIntR
 */
                                __pyx_v_dIntR = (((0.5 * __pyx_v_dtmp) * __pyx_v_dtmp) * __pyx_v_inv_dbin2);
 165:                     dInt = dInt - dIntR
                                /* "histogram.pyx":165
 *                 if dtmp > 0 :
 *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntR             # <<<<<<<<<<<<<<
 *                     bigCount[dest + 1] += dIntR
 *                     bigData[dest + 1] += d * dIntR
 */
                                __pyx_v_dInt = (__pyx_v_dInt - __pyx_v_dIntR);
 166:                     bigCount[dest + 1] += dIntR
                                /* "histogram.pyx":166
 *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
 *                     dInt = dInt - dIntR
 *                     bigCount[dest + 1] += dIntR             # <<<<<<<<<<<<<<
 *                     bigData[dest + 1] += d * dIntR
 *             bigCount[dest] += dInt
 */
                                __pyx_t_23 = (__pyx_v_dest + 1);
                                (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dIntR);
 167:                     bigData[dest + 1] += d * dIntR
                                /* "histogram.pyx":167
 *                     dInt = dInt - dIntR
 *                     bigCount[dest + 1] += dIntR
 *                     bigData[dest + 1] += d * dIntR             # <<<<<<<<<<<<<<
 *             bigCount[dest] += dInt
 *             bigData[dest] += d * dInt
 */
                                __pyx_t_23 = (__pyx_v_dest + 1);
                                (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dIntR));
                                goto __pyx_L23;
                              }
                              __pyx_L23:;
                              goto __pyx_L22;
                            }
                            __pyx_L22:;
 168:             bigCount[dest] += dInt
                            /* "histogram.pyx":168
 *                     bigCount[dest + 1] += dIntR
 *                     bigData[dest + 1] += d * dIntR
 *             bigCount[dest] += dInt             # <<<<<<<<<<<<<<
 *             bigData[dest] += d * dInt
 * 
 */
                            __pyx_t_23 = __pyx_v_dest;
                            (__pyx_v_bigCount[__pyx_t_23]) = ((__pyx_v_bigCount[__pyx_t_23]) + __pyx_v_dInt);
 169:             bigData[dest] += d * dInt
                            /* "histogram.pyx":169
 *                     bigData[dest + 1] += d * dIntR
 *             bigCount[dest] += dInt
 *             bigData[dest] += d * dInt             # <<<<<<<<<<<<<<
 * 
 *         for idx in prange(bins):
 */
                            __pyx_t_23 = __pyx_v_dest;
                            (__pyx_v_bigData[__pyx_t_23]) = ((__pyx_v_bigData[__pyx_t_23]) + (__pyx_v_d * __pyx_v_dInt));
                            goto __pyx_L25;
                            __pyx_L15_continue:;
                            goto __pyx_L25;
                            __pyx_L25:;
                        }
                    }
                }
            }
        }
 170: 
 171:         for idx in prange(bins):
        /* "histogram.pyx":171
 *             bigData[dest] += d * dInt
 * 
 *         for idx in prange(bins):             # <<<<<<<<<<<<<<
 *             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width
 *             tmp_count = 0.0
 */
        __pyx_t_20 = __pyx_v_bins;
        if (1 == 0) abort();
        {
            __pyx_t_5 = (__pyx_t_20 - 0) / 1;
            if (__pyx_t_5 > 0)
            {
                __pyx_v_idx = 0;
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for reduction(+:__pyx_v_tmp_count) reduction(+:__pyx_v_tmp_data) lastprivate(__pyx_v_t) firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_dest)
                    #endif /* _OPENMP */
                    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_5; __pyx_t_19++){
                        {
                            __pyx_v_idx = 0 + 1 * __pyx_t_19;
                            /* Initialize private variables to invalid values */
                            __pyx_v_t = ((long)0xbad0bad0);
                            __pyx_v_dest = ((long)0xbad0bad0);
 172:             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width
                            /* "histogram.pyx":172
 * 
 *         for idx in prange(bins):
 *             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width             # <<<<<<<<<<<<<<
 *             tmp_count = 0.0
 *             tmp_data = 0.0
 */
                            __pyx_t_23 = __pyx_v_idx;
                            *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outPos.buf, __pyx_t_23, __pyx_bstride_0_outPos) = (__pyx_v_bin_edge_min + ((0.5 + ((double)__pyx_v_idx)) * __pyx_v_bin_width));
 173:             tmp_count = 0.0
                            /* "histogram.pyx":173
 *         for idx in prange(bins):
 *             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width
 *             tmp_count = 0.0             # <<<<<<<<<<<<<<
 *             tmp_data = 0.0
 *             for t in range(omp_get_max_threads()):
 */
                            __pyx_v_tmp_count = 0.0;
 174:             tmp_data = 0.0
                            /* "histogram.pyx":174
 *             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width
 *             tmp_count = 0.0
 *             tmp_data = 0.0             # <<<<<<<<<<<<<<
 *             for t in range(omp_get_max_threads()):
 *                 dest = t * bins + idx
 */
                            __pyx_v_tmp_data = 0.0;
 175:             for t in range(omp_get_max_threads()):
                            /* "histogram.pyx":175
 *             tmp_count = 0.0
 *             tmp_data = 0.0
 *             for t in range(omp_get_max_threads()):             # <<<<<<<<<<<<<<
 *                 dest = t * bins + idx
 *                 tmp_count += bigCount[dest]
 */
                            __pyx_t_17 = omp_get_max_threads();
                            for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_17; __pyx_t_24+=1) {
                              __pyx_v_t = __pyx_t_24;
 176:                 dest = t * bins + idx
                              /* "histogram.pyx":176
 *             tmp_data = 0.0
 *             for t in range(omp_get_max_threads()):
 *                 dest = t * bins + idx             # <<<<<<<<<<<<<<
 *                 tmp_count += bigCount[dest]
 *                 tmp_data += bigData[dest]
 */
                              __pyx_v_dest = ((__pyx_v_t * __pyx_v_bins) + __pyx_v_idx);
 177:                 tmp_count += bigCount[dest]
                              /* "histogram.pyx":177
 *             for t in range(omp_get_max_threads()):
 *                 dest = t * bins + idx
 *                 tmp_count += bigCount[dest]             # <<<<<<<<<<<<<<
 *                 tmp_data += bigData[dest]
 *             outCount[idx] += tmp_count
 */
                              __pyx_v_tmp_count = (__pyx_v_tmp_count + (__pyx_v_bigCount[__pyx_v_dest]));
 178:                 tmp_data += bigData[dest]
                              /* "histogram.pyx":178
 *                 dest = t * bins + idx
 *                 tmp_count += bigCount[dest]
 *                 tmp_data += bigData[dest]             # <<<<<<<<<<<<<<
 *             outCount[idx] += tmp_count
 *             outData[idx] += tmp_data
 */
                              __pyx_v_tmp_data = (__pyx_v_tmp_data + (__pyx_v_bigData[__pyx_v_dest]));
                            }
 179:             outCount[idx] += tmp_count
                            /* "histogram.pyx":179
 *                 tmp_count += bigCount[dest]
 *                 tmp_data += bigData[dest]
 *             outCount[idx] += tmp_count             # <<<<<<<<<<<<<<
 *             outData[idx] += tmp_data
 *             if outCount[idx] > epsilon:
 */
                            __pyx_t_24 = __pyx_v_idx;
                            *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_24, __pyx_bstride_0_outCount) += __pyx_v_tmp_count;
 180:             outData[idx] += tmp_data
                            /* "histogram.pyx":180
 *                 tmp_data += bigData[dest]
 *             outCount[idx] += tmp_count
 *             outData[idx] += tmp_data             # <<<<<<<<<<<<<<
 *             if outCount[idx] > epsilon:
 *                 outMerge[idx] += tmp_data / tmp_count
 */
                            __pyx_t_25 = __pyx_v_idx;
                            *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_25, __pyx_bstride_0_outData) += __pyx_v_tmp_data;
 181:             if outCount[idx] > epsilon:
                            /* "histogram.pyx":181
 *             outCount[idx] += tmp_count
 *             outData[idx] += tmp_data
 *             if outCount[idx] > epsilon:             # <<<<<<<<<<<<<<
 *                 outMerge[idx] += tmp_data / tmp_count
 *             else:
 */
                            __pyx_t_26 = __pyx_v_idx;
                            __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_26, __pyx_bstride_0_outCount)) > __pyx_v_epsilon);
                            if (__pyx_t_4) {
 182:                 outMerge[idx] += tmp_data / tmp_count
                              /* "histogram.pyx":182
 *             outData[idx] += tmp_data
 *             if outCount[idx] > epsilon:
 *                 outMerge[idx] += tmp_data / tmp_count             # <<<<<<<<<<<<<<
 *             else:
 *                 outMerge[idx] += dummy
 */
                              __pyx_t_27 = __pyx_v_idx;
                              *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_27, __pyx_bstride_0_outMerge) += (__pyx_v_tmp_data / __pyx_v_tmp_count);
                              goto __pyx_L32;
                            }
                            /*else*/ {
 183:             else:
 184:                 outMerge[idx] += dummy
                              /* "histogram.pyx":184
 *                 outMerge[idx] += tmp_data / tmp_count
 *             else:
 *                 outMerge[idx] += dummy             # <<<<<<<<<<<<<<
 * 
 *     free(bigCount)
 */
                              __pyx_t_28 = __pyx_v_idx;
                              *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_28, __pyx_bstride_0_outMerge) += __pyx_v_dummy;
                            }
                            __pyx_L32:;
                        }
                    }
                }
            }
        }
      }
 185: 
 186:     free(bigCount)
  /* "histogram.pyx":186
 *                 outMerge[idx] += dummy
 * 
 *     free(bigCount)             # <<<<<<<<<<<<<<
 *     free(bigData)
 *     return  outPos, outMerge, outData, outCount
 */
  free(__pyx_v_bigCount);
 187:     free(bigData)
  /* "histogram.pyx":187
 * 
 *     free(bigCount)
 *     free(bigData)             # <<<<<<<<<<<<<<
 *     return  outPos, outMerge, outData, outCount
 * 
 */
  free(__pyx_v_bigData);
 188:     return  outPos, outMerge, outData, outCount
  /* "histogram.pyx":188
 *     free(bigCount)
 *     free(bigData)
 *     return  outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_outPos));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos));
  __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
  __pyx_r = ((PyObject *)__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_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("histogram.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_outPos);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 189: 
 190: 
 191: @cython.cdivision(True)
 192: @cython.boundscheck(False)
 193: @cython.wraparound(False)
 194: def histogram2d(numpy.ndarray pos0 not None,
/* "histogram.pyx":194
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram2d(numpy.ndarray pos0 not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos1 not None,
 *                 bins not None,
 */

static PyObject *__pyx_pf_9histogram_1histogram2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9histogram_1histogram2d[] = "\n    Calculate 2D histogram of pos0,pos1 weighted by weights\n\n    @param pos0: 2Theta array\n    @param pos1: Chi array\n    @param weights: array with intensities\n    @param bins: number of output bins int or 2-tuple of int\n    @param nthread: maximum number of thread to use. By default: maximum available. \n    One can also limit this with OMP_NUM_THREADS environment variable\n\n    \n    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n    ";
static PyMethodDef __pyx_mdef_9histogram_1histogram2d = {__Pyx_NAMESTR("histogram2d"), (PyCFunction)__pyx_pf_9histogram_1histogram2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9histogram_1histogram2d)};
static PyObject *__pyx_pf_9histogram_1histogram2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pos0 = 0;
  PyArrayObject *__pyx_v_pos1 = 0;
  PyObject *__pyx_v_bins = 0;
  PyArrayObject *__pyx_v_weights = 0;
  PyObject *__pyx_v_split = 0;
  PyObject *__pyx_v_nthread = 0;
  double __pyx_v_dummy;
  long __pyx_v_bin0;
  long __pyx_v_bin1;
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_v_b0;
  long __pyx_v_b1;
  long __pyx_v_size;
  int __pyx_v_csplit;
  PyArrayObject *__pyx_v_cpos0 = 0;
  PyArrayObject *__pyx_v_cpos1 = 0;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_edges0 = 0;
  PyArrayObject *__pyx_v_edges1 = 0;
  double __pyx_v_min0;
  double __pyx_v_max0;
  double __pyx_v_min1;
  double __pyx_v_max1;
  double __pyx_v_idp0;
  double __pyx_v_idp1;
  double __pyx_v_dbin0;
  double __pyx_v_dbin1;
  double __pyx_v_fbin0;
  double __pyx_v_fbin1;
  double __pyx_v_p0;
  double __pyx_v_p1;
  double __pyx_v_d;
  double __pyx_v_rest;
  double __pyx_v_delta0l;
  double __pyx_v_delta0r;
  double __pyx_v_delta1l;
  double __pyx_v_delta1r;
  double __pyx_v_area;
  Py_buffer __pyx_bstruct_edges0;
  Py_ssize_t __pyx_bstride_0_edges0 = 0;
  Py_ssize_t __pyx_bshape_0_edges0 = 0;
  Py_buffer __pyx_bstruct_edges1;
  Py_ssize_t __pyx_bstride_0_edges1 = 0;
  Py_ssize_t __pyx_bshape_0_edges1 = 0;
  Py_buffer __pyx_bstruct_outMerge;
  Py_ssize_t __pyx_bstride_0_outMerge = 0;
  Py_ssize_t __pyx_bstride_1_outMerge = 0;
  Py_ssize_t __pyx_bshape_0_outMerge = 0;
  Py_ssize_t __pyx_bshape_1_outMerge = 0;
  Py_buffer __pyx_bstruct_outCount;
  Py_ssize_t __pyx_bstride_0_outCount = 0;
  Py_ssize_t __pyx_bstride_1_outCount = 0;
  Py_ssize_t __pyx_bshape_0_outCount = 0;
  Py_ssize_t __pyx_bshape_1_outCount = 0;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_buffer __pyx_bstruct_cpos1;
  Py_ssize_t __pyx_bstride_0_cpos1 = 0;
  Py_ssize_t __pyx_bshape_0_cpos1 = 0;
  Py_buffer __pyx_bstruct_cpos0;
  Py_ssize_t __pyx_bstride_0_cpos0 = 0;
  Py_ssize_t __pyx_bshape_0_cpos0 = 0;
  Py_buffer __pyx_bstruct_outData;
  Py_ssize_t __pyx_bstride_0_outData = 0;
  Py_ssize_t __pyx_bstride_1_outData = 0;
  Py_ssize_t __pyx_bshape_0_outData = 0;
  Py_ssize_t __pyx_bshape_1_outData = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos0,&__pyx_n_s__pos1,&__pyx_n_s__bins,&__pyx_n_s__weights,&__pyx_n_s__split,&__pyx_n_s__nthread,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram2d");
  __pyx_self = __pyx_self;
  {
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[4] = __pyx_k_3;

  /* "histogram.pyx":194
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram2d(numpy.ndarray pos0 not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos1 not None,
 *                 bins not None,
 */
  __pyx_k_tuple_22 = PyTuple_New(43); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__pos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, ((PyObject *)__pyx_n_s__pos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 3, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__split));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 4, ((PyObject *)__pyx_n_s__split));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__split));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nthread));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 5, ((PyObject *)__pyx_n_s__nthread));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nthread));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 6, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 7, ((PyObject *)__pyx_n_s__bin0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 8, ((PyObject *)__pyx_n_s__bin1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 9, ((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_22, 10, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 11, ((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_22, 12, ((PyObject *)__pyx_n_s__b1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 13, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__csplit));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 14, ((PyObject *)__pyx_n_s__csplit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csplit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 15, ((PyObject *)__pyx_n_s__cpos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 16, ((PyObject *)__pyx_n_s__cpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 17, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 18, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 19, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 20, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 21, ((PyObject *)__pyx_n_s__edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 22, ((PyObject *)__pyx_n_s__edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 23, ((PyObject *)__pyx_n_s__min0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 24, ((PyObject *)__pyx_n_s__max0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 25, ((PyObject *)__pyx_n_s__min1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 26, ((PyObject *)__pyx_n_s__max1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idp0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 27, ((PyObject *)__pyx_n_s__idp0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idp0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idp1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 28, ((PyObject *)__pyx_n_s__idp1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idp1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 29, ((PyObject *)__pyx_n_s__dbin0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dbin1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 30, ((PyObject *)__pyx_n_s__dbin1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dbin1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 31, ((PyObject *)__pyx_n_s__fbin0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 32, ((PyObject *)__pyx_n_s__fbin1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__p0));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 33, ((PyObject *)__pyx_n_s__p0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__p1));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 34, ((PyObject *)__pyx_n_s__p1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 35, ((PyObject *)__pyx_n_s__d));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rest));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 36, ((PyObject *)__pyx_n_s__rest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0l));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 37, ((PyObject *)__pyx_n_s__delta0l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0l));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0r));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 38, ((PyObject *)__pyx_n_s__delta0r));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0r));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1l));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 39, ((PyObject *)__pyx_n_s__delta1l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1l));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1r));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 40, ((PyObject *)__pyx_n_s__delta1r));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1r));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aera));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 41, ((PyObject *)__pyx_n_s__aera));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aera));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__area));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 42, ((PyObject *)__pyx_n_s__area));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__area));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "histogram.pyx":194
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def histogram2d(numpy.ndarray pos0 not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray pos1 not None,
 *                 bins not None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9histogram_1histogram2d, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histogram2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 195:                 numpy.ndarray pos1 not None,
 196:                 bins not None,
 197:                 numpy.ndarray weights not None,
 198:                 split=True,
  /* "histogram.pyx":198
 *                 bins not None,
 *                 numpy.ndarray weights not None,
 *                 split=True,             # <<<<<<<<<<<<<<
 *                 nthread=None,
 *                 double dummy=0.0):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_3 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
 199:                 nthread=None,
    /* "histogram.pyx":199
 *                 numpy.ndarray weights not None,
 *                 split=True,
 *                 nthread=None,             # <<<<<<<<<<<<<<
 *                 double dummy=0.0):
 *     """
 */
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__split);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nthread);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "histogram2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pos0 = ((PyArrayObject *)values[0]);
    __pyx_v_pos1 = ((PyArrayObject *)values[1]);
    __pyx_v_bins = values[2];
    __pyx_v_weights = ((PyArrayObject *)values[3]);
    __pyx_v_split = values[4];
    __pyx_v_nthread = values[5];
    if (values[6]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
 200:                 double dummy=0.0):
      /* "histogram.pyx":200
 *                 split=True,
 *                 nthread=None,
 *                 double dummy=0.0):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate 2D histogram of pos0,pos1 weighted by weights
 */
      __pyx_v_dummy = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_cpos0.buf = NULL;
  __pyx_bstruct_cpos1.buf = NULL;
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_outData.buf = NULL;
  __pyx_bstruct_outCount.buf = NULL;
  __pyx_bstruct_outMerge.buf = NULL;
  __pyx_bstruct_edges0.buf = NULL;
  __pyx_bstruct_edges1.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos1), __pyx_ptype_5numpy_ndarray, 0, "pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(((PyObject *)__pyx_v_bins) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument 'bins' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 201:     """
 202:     Calculate 2D histogram of pos0,pos1 weighted by weights
 203: 
 204:     @param pos0: 2Theta array
 205:     @param pos1: Chi array
 206:     @param weights: array with intensities
 207:     @param bins: number of output bins int or 2-tuple of int
 208:     @param nthread: maximum number of thread to use. By default: maximum available.
 209:     One can also limit this with OMP_NUM_THREADS environment variable
 210: 
 211: 
 212:     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
 213:     """
 214:     assert pos0.size == pos1.size
  /* "histogram.pyx":214
 *     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
 *     """
 *     assert pos0.size == pos1.size             # <<<<<<<<<<<<<<
 * #    if weights is not No:
 *     assert pos0.size == weights.size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 215: #    if weights is not No:
 216:     assert pos0.size == weights.size
  /* "histogram.pyx":216
 *     assert pos0.size == pos1.size
 * #    if weights is not No:
 *     assert pos0.size == weights.size             # <<<<<<<<<<<<<<
 *     cdef long  bin0, bin1, i, j, b0, b1
 *     cdef long  size = pos0.size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 217:     cdef long  bin0, bin1, i, j, b0, b1
 218:     cdef long  size = pos0.size
  /* "histogram.pyx":218
 *     assert pos0.size == weights.size
 *     cdef long  bin0, bin1, i, j, b0, b1
 *     cdef long  size = pos0.size             # <<<<<<<<<<<<<<
 *     try:
 *         bin0, bin1 = tuple(bins)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_size = __pyx_t_5;
 219:     try:
  /* "histogram.pyx":219
 *     cdef long  bin0, bin1, i, j, b0, b1
 *     cdef long  size = pos0.size
 *     try:             # <<<<<<<<<<<<<<
 *         bin0, bin1 = tuple(bins)
 *     except:
 */
  {
    __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:*/ {
 220:         bin0, bin1 = tuple(bins)
      /* "histogram.pyx":220
 *     cdef long  size = pos0.size
 *     try:
 *         bin0, bin1 = tuple(bins)             # <<<<<<<<<<<<<<
 *     except:
 *         bin0 = bin1 = < long > bins
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_bins);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bins);
      __Pyx_GIVEREF(__pyx_v_bins);
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_2, 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      }
      __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bin0 = __pyx_t_5;
      __pyx_v_bin1 = __pyx_t_9;
    }
    __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_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 221:     except:
    /* "histogram.pyx":221
 *     try:
 *         bin0, bin1 = tuple(bins)
 *     except:             # <<<<<<<<<<<<<<
 *         bin0 = bin1 = < long > bins
 *     if bin0 <= 0:
 */
    /*except:*/ {
      __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
 222:         bin0 = bin1 = < long > bins
      /* "histogram.pyx":222
 *         bin0, bin1 = tuple(bins)
 *     except:
 *         bin0 = bin1 = < long > bins             # <<<<<<<<<<<<<<
 *     if bin0 <= 0:
 *         bin0 = 1
 */
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __pyx_v_bin0 = ((long)__pyx_t_9);
      __pyx_v_bin1 = ((long)__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_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_L7_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_L13_try_end:;
  }
 223:     if bin0 <= 0:
  /* "histogram.pyx":223
 *     except:
 *         bin0 = bin1 = < long > bins
 *     if bin0 <= 0:             # <<<<<<<<<<<<<<
 *         bin0 = 1
 *     if bin1 <= 0:
 */
  __pyx_t_4 = (__pyx_v_bin0 <= 0);
  if (__pyx_t_4) {
 224:         bin0 = 1
    /* "histogram.pyx":224
 *         bin0 = bin1 = < long > bins
 *     if bin0 <= 0:
 *         bin0 = 1             # <<<<<<<<<<<<<<
 *     if bin1 <= 0:
 *         bin1 = 1
 */
    __pyx_v_bin0 = 1;
    goto __pyx_L16;
  }
  __pyx_L16:;
 225:     if bin1 <= 0:
  /* "histogram.pyx":225
 *     if bin0 <= 0:
 *         bin0 = 1
 *     if bin1 <= 0:             # <<<<<<<<<<<<<<
 *         bin1 = 1
 *     cdef int csplit = split
 */
  __pyx_t_4 = (__pyx_v_bin1 <= 0);
  if (__pyx_t_4) {
 226:         bin1 = 1
    /* "histogram.pyx":226
 *         bin0 = 1
 *     if bin1 <= 0:
 *         bin1 = 1             # <<<<<<<<<<<<<<
 *     cdef int csplit = split
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 */
    __pyx_v_bin1 = 1;
    goto __pyx_L17;
  }
  __pyx_L17:;
 227:     cdef int csplit = split
  /* "histogram.pyx":227
 *     if bin1 <= 0:
 *         bin1 = 1
 *     cdef int csplit = split             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 */
  __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_split); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_csplit = __pyx_t_10;
 228:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
  /* "histogram.pyx":228
 *         bin1 = 1
 *     cdef int csplit = split
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __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 = 228; __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 = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos0, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos0.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cpos0 = __pyx_bstruct_cpos0.strides[0];
      __pyx_bshape_0_cpos0 = __pyx_bstruct_cpos0.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "histogram.pyx":228
 *         bin1 = 1
 *     cdef int csplit = split
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 */
  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 229:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
  /* "histogram.pyx":229
 *     cdef int csplit = split
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos1, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos1.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cpos1 = __pyx_bstruct_cpos1.strides[0];
      __pyx_bshape_0_cpos1 = __pyx_bstruct_cpos1.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "histogram.pyx":229
 *     cdef int csplit = split
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 230:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
  /* "histogram.pyx":230
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __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 = 230; __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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_data = __pyx_bstruct_data.strides[0];
      __pyx_bshape_0_data = __pyx_bstruct_data.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_data = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "histogram.pyx":230
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
 */
  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 231:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
  /* "histogram.pyx":231
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bstride_1_outData = __pyx_bstruct_outData.strides[1];
      __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; __pyx_bshape_1_outData = __pyx_bstruct_outData.shape[1];
    }
  }
  __pyx_t_15 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 232:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
  /* "histogram.pyx":232
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_14, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bstride_1_outCount = __pyx_bstruct_outCount.strides[1];
      __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; __pyx_bshape_1_outCount = __pyx_bstruct_outCount.shape[1];
    }
  }
  __pyx_t_16 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 233:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
  /* "histogram.pyx":233
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bstride_1_outMerge = __pyx_bstruct_outMerge.strides[1];
      __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; __pyx_bshape_1_outMerge = __pyx_bstruct_outMerge.shape[1];
    }
  }
  __pyx_t_17 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 234:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
  /* "histogram.pyx":234
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
 *     cdef double min0 = pos0.min()
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 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 = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_14, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges0, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges0.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_edges0 = __pyx_bstruct_edges0.strides[0];
      __pyx_bshape_0_edges0 = __pyx_bstruct_edges0.shape[0];
    }
  }
  __pyx_t_18 = 0;
  __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 235:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
  /* "histogram.pyx":235
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef double min0 = pos0.min()
 *     cdef double max0 = pos0.max()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges1, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_9histogram_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges1.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_edges1 = __pyx_bstruct_edges1.strides[0];
      __pyx_bshape_0_edges1 = __pyx_bstruct_edges1.shape[0];
    }
  }
  __pyx_t_19 = 0;
  __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;
 236:     cdef double min0 = pos0.min()
  /* "histogram.pyx":236
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
 *     cdef double min0 = pos0.min()             # <<<<<<<<<<<<<<
 *     cdef double max0 = pos0.max()
 *     cdef double min1 = pos1.min()
 */
  __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_min0 = __pyx_t_20;
 237:     cdef double max0 = pos0.max()
  /* "histogram.pyx":237
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
 *     cdef double min0 = pos0.min()
 *     cdef double max0 = pos0.max()             # <<<<<<<<<<<<<<
 *     cdef double min1 = pos1.min()
 *     cdef double max1 = pos1.max()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_v_max0 = __pyx_t_20;
 238:     cdef double min1 = pos1.min()
  /* "histogram.pyx":238
 *     cdef double min0 = pos0.min()
 *     cdef double max0 = pos0.max()
 *     cdef double min1 = pos1.min()             # <<<<<<<<<<<<<<
 *     cdef double max1 = pos1.max()
 *     cdef double idp0 = (< double > bin0) / (max0 - min0)
 */
  __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_min1 = __pyx_t_20;
 239:     cdef double max1 = pos1.max()
  /* "histogram.pyx":239
 *     cdef double max0 = pos0.max()
 *     cdef double min1 = pos1.min()
 *     cdef double max1 = pos1.max()             # <<<<<<<<<<<<<<
 *     cdef double idp0 = (< double > bin0) / (max0 - min0)
 *     cdef double idp1 = (< double > bin1) / (max1 - min1)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_v_max1 = __pyx_t_20;
 240:     cdef double idp0 = (< double > bin0) / (max0 - min0)
  /* "histogram.pyx":240
 *     cdef double min1 = pos1.min()
 *     cdef double max1 = pos1.max()
 *     cdef double idp0 = (< double > bin0) / (max0 - min0)             # <<<<<<<<<<<<<<
 *     cdef double idp1 = (< double > bin1) / (max1 - min1)
 *     cdef double dbin0 = 0.5, dbin1 = 0.5
 */
  __pyx_v_idp0 = (((double)__pyx_v_bin0) / (__pyx_v_max0 - __pyx_v_min0));
 241:     cdef double idp1 = (< double > bin1) / (max1 - min1)
  /* "histogram.pyx":241
 *     cdef double max1 = pos1.max()
 *     cdef double idp0 = (< double > bin0) / (max0 - min0)
 *     cdef double idp1 = (< double > bin1) / (max1 - min1)             # <<<<<<<<<<<<<<
 *     cdef double dbin0 = 0.5, dbin1 = 0.5
 *     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
 */
  __pyx_v_idp1 = (((double)__pyx_v_bin1) / (__pyx_v_max1 - __pyx_v_min1));
 242:     cdef double dbin0 = 0.5, dbin1 = 0.5
  /* "histogram.pyx":242
 *     cdef double idp0 = (< double > bin0) / (max0 - min0)
 *     cdef double idp1 = (< double > bin1) / (max1 - min1)
 *     cdef double dbin0 = 0.5, dbin1 = 0.5             # <<<<<<<<<<<<<<
 *     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
 *     if nthread is not None:
 */
  __pyx_v_dbin0 = 0.5;
  __pyx_v_dbin1 = 0.5;
 243:     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
 244:     if nthread is not None:
  /* "histogram.pyx":244
 *     cdef double dbin0 = 0.5, dbin1 = 0.5
 *     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
 *     if nthread is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)
 */
  __pyx_t_4 = (__pyx_v_nthread != Py_None);
  if (__pyx_t_4) {
 245:         if isinstance(nthread, int) and (nthread > 0):
    /* "histogram.pyx":245
 *     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
 *     if nthread is not None:
 *         if isinstance(nthread, int) and (nthread > 0):             # <<<<<<<<<<<<<<
 *             omp_set_num_threads(< int > nthread)
 *     with nogil:
 */
    __pyx_t_14 = ((PyObject *)((PyObject*)(&PyInt_Type)));
    __Pyx_INCREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_nthread, __pyx_t_14); 
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (__pyx_t_4) {
      __pyx_t_14 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_22 = __pyx_t_21;
    } else {
      __pyx_t_22 = __pyx_t_4;
    }
    if (__pyx_t_22) {
 246:             omp_set_num_threads(< int > nthread)
      /* "histogram.pyx":246
 *     if nthread is not None:
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)             # <<<<<<<<<<<<<<
 *     with nogil:
 *         for i in prange(bin0):
 */
      __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_nthread); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      omp_set_num_threads(((int)__pyx_t_10));
      goto __pyx_L19;
    }
    __pyx_L19:;
    goto __pyx_L18;
  }
  __pyx_L18:;
 247:     with nogil:
  /* "histogram.pyx":247
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(bin0):
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "histogram.pyx":247
 *         if isinstance(nthread, int) and (nthread > 0):
 *             omp_set_num_threads(< int > nthread)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(bin0):
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
  }
 248:         for i in prange(bin0):
        /* "histogram.pyx":248
 *             omp_set_num_threads(< int > nthread)
 *     with nogil:
 *         for i in prange(bin0):             # <<<<<<<<<<<<<<
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0
 *         for i in prange(bin1):
 */
        __pyx_t_9 = __pyx_v_bin0;
        if (1 == 0) abort();
        {
            __pyx_t_23 = (__pyx_t_9 - 0) / 1;
            if (__pyx_t_23 > 0)
            {
                __pyx_v_i = 0;
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i)
                    #endif /* _OPENMP */
                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_23; __pyx_t_5++){
                        {
                            __pyx_v_i = 0 + 1 * __pyx_t_5;
 249:             edges0[i] = min0 + (0.5 +< double > i) / idp0
                            /* "histogram.pyx":249
 *     with nogil:
 *         for i in prange(bin0):
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0             # <<<<<<<<<<<<<<
 *         for i in prange(bin1):
 *             edges1[i] = min1 + (0.5 +< double > i) / idp1
 */
                            __pyx_t_24 = __pyx_v_i;
                            *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_edges0.buf, __pyx_t_24, __pyx_bstride_0_edges0) = (__pyx_v_min0 + ((0.5 + ((double)__pyx_v_i)) / __pyx_v_idp0));
                        }
                    }
                }
            }
        }
 250:         for i in prange(bin1):
        /* "histogram.pyx":250
 *         for i in prange(bin0):
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0
 *         for i in prange(bin1):             # <<<<<<<<<<<<<<
 *             edges1[i] = min1 + (0.5 +< double > i) / idp1
 *         for i in range(size):
 */
        __pyx_t_23 = __pyx_v_bin1;
        if (1 == 0) abort();
        {
            __pyx_t_9 = (__pyx_t_23 - 0) / 1;
            if (__pyx_t_9 > 0)
            {
                __pyx_v_i = 0;
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i)
                    #endif /* _OPENMP */
                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_9; __pyx_t_5++){
                        {
                            __pyx_v_i = 0 + 1 * __pyx_t_5;
 251:             edges1[i] = min1 + (0.5 +< double > i) / idp1
                            /* "histogram.pyx":251
 *             edges0[i] = min0 + (0.5 +< double > i) / idp0
 *         for i in prange(bin1):
 *             edges1[i] = min1 + (0.5 +< double > i) / idp1             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             p0 = cpos0[i]
 */
                            __pyx_t_25 = __pyx_v_i;
                            *__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_edges1.buf, __pyx_t_25, __pyx_bstride_0_edges1) = (__pyx_v_min1 + ((0.5 + ((double)__pyx_v_i)) / __pyx_v_idp1));
                        }
                    }
                }
            }
        }
 252:         for i in range(size):
        /* "histogram.pyx":252
 *         for i in prange(bin1):
 *             edges1[i] = min1 + (0.5 +< double > i) / idp1
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             p0 = cpos0[i]
 *             p1 = cpos1[i]
 */
        __pyx_t_9 = __pyx_v_size;
        for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_9; __pyx_t_5+=1) {
          __pyx_v_i = __pyx_t_5;
 253:             p0 = cpos0[i]
          /* "histogram.pyx":253
 *             edges1[i] = min1 + (0.5 +< double > i) / idp1
 *         for i in range(size):
 *             p0 = cpos0[i]             # <<<<<<<<<<<<<<
 *             p1 = cpos1[i]
 *             d = data[i]
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_v_p0 = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos0.buf, __pyx_t_23, __pyx_bstride_0_cpos0));
 254:             p1 = cpos1[i]
          /* "histogram.pyx":254
 *         for i in range(size):
 *             p0 = cpos0[i]
 *             p1 = cpos1[i]             # <<<<<<<<<<<<<<
 *             d = data[i]
 *             fbin0 = (p0 - min0) * idp0
 */
          __pyx_t_26 = __pyx_v_i;
          __pyx_v_p1 = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_cpos1.buf, __pyx_t_26, __pyx_bstride_0_cpos1));
 255:             d = data[i]
          /* "histogram.pyx":255
 *             p0 = cpos0[i]
 *             p1 = cpos1[i]
 *             d = data[i]             # <<<<<<<<<<<<<<
 *             fbin0 = (p0 - min0) * idp0
 *             fbin1 = (p1 - min1) * idp1
 */
          __pyx_t_27 = __pyx_v_i;
          __pyx_v_d = (*__Pyx_BufPtrStrided1d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_data.buf, __pyx_t_27, __pyx_bstride_0_data));
 256:             fbin0 = (p0 - min0) * idp0
          /* "histogram.pyx":256
 *             p1 = cpos1[i]
 *             d = data[i]
 *             fbin0 = (p0 - min0) * idp0             # <<<<<<<<<<<<<<
 *             fbin1 = (p1 - min1) * idp1
 *             b0 = < long > floor(fbin0)
 */
          __pyx_v_fbin0 = ((__pyx_v_p0 - __pyx_v_min0) * __pyx_v_idp0);
 257:             fbin1 = (p1 - min1) * idp1
          /* "histogram.pyx":257
 *             d = data[i]
 *             fbin0 = (p0 - min0) * idp0
 *             fbin1 = (p1 - min1) * idp1             # <<<<<<<<<<<<<<
 *             b0 = < long > floor(fbin0)
 *             b1 = < long > floor(fbin1)
 */
          __pyx_v_fbin1 = ((__pyx_v_p1 - __pyx_v_min1) * __pyx_v_idp1);
 258:             b0 = < long > floor(fbin0)
          /* "histogram.pyx":258
 *             fbin0 = (p0 - min0) * idp0
 *             fbin1 = (p1 - min1) * idp1
 *             b0 = < long > floor(fbin0)             # <<<<<<<<<<<<<<
 *             b1 = < long > floor(fbin1)
 *             if b0 == bin0:
 */
          __pyx_v_b0 = ((long)floor(__pyx_v_fbin0));
 259:             b1 = < long > floor(fbin1)
          /* "histogram.pyx":259
 *             fbin1 = (p1 - min1) * idp1
 *             b0 = < long > floor(fbin0)
 *             b1 = < long > floor(fbin1)             # <<<<<<<<<<<<<<
 *             if b0 == bin0:
 *                 b0 = bin0 - 1
 */
          __pyx_v_b1 = ((long)floor(__pyx_v_fbin1));
 260:             if b0 == bin0:
          /* "histogram.pyx":260
 *             b0 = < long > floor(fbin0)
 *             b1 = < long > floor(fbin1)
 *             if b0 == bin0:             # <<<<<<<<<<<<<<
 *                 b0 = bin0 - 1
 *                 fbin0 = (< double > bin0) - 0.5
 */
          __pyx_t_22 = (__pyx_v_b0 == __pyx_v_bin0);
          if (__pyx_t_22) {
 261:                 b0 = bin0 - 1
            /* "histogram.pyx":261
 *             b1 = < long > floor(fbin1)
 *             if b0 == bin0:
 *                 b0 = bin0 - 1             # <<<<<<<<<<<<<<
 *                 fbin0 = (< double > bin0) - 0.5
 *             elif b0 == 0:
 */
            __pyx_v_b0 = (__pyx_v_bin0 - 1);
 262:                 fbin0 = (< double > bin0) - 0.5
            /* "histogram.pyx":262
 *             if b0 == bin0:
 *                 b0 = bin0 - 1
 *                 fbin0 = (< double > bin0) - 0.5             # <<<<<<<<<<<<<<
 *             elif b0 == 0:
 *                 fbin0 = 0.5
 */
            __pyx_v_fbin0 = (((double)__pyx_v_bin0) - 0.5);
            goto __pyx_L37;
          }
 263:             elif b0 == 0:
          /* "histogram.pyx":263
 *                 b0 = bin0 - 1
 *                 fbin0 = (< double > bin0) - 0.5
 *             elif b0 == 0:             # <<<<<<<<<<<<<<
 *                 fbin0 = 0.5
 *             if b1 == bin1:
 */
          __pyx_t_22 = (__pyx_v_b0 == 0);
          if (__pyx_t_22) {
 264:                 fbin0 = 0.5
            /* "histogram.pyx":264
 *                 fbin0 = (< double > bin0) - 0.5
 *             elif b0 == 0:
 *                 fbin0 = 0.5             # <<<<<<<<<<<<<<
 *             if b1 == bin1:
 *                 b1 = bin1 - 1
 */
            __pyx_v_fbin0 = 0.5;
            goto __pyx_L37;
          }
          __pyx_L37:;
 265:             if b1 == bin1:
          /* "histogram.pyx":265
 *             elif b0 == 0:
 *                 fbin0 = 0.5
 *             if b1 == bin1:             # <<<<<<<<<<<<<<
 *                 b1 = bin1 - 1
 *                 fbin1 = (< double > bin1) - 0.5
 */
          __pyx_t_22 = (__pyx_v_b1 == __pyx_v_bin1);
          if (__pyx_t_22) {
 266:                 b1 = bin1 - 1
            /* "histogram.pyx":266
 *                 fbin0 = 0.5
 *             if b1 == bin1:
 *                 b1 = bin1 - 1             # <<<<<<<<<<<<<<
 *                 fbin1 = (< double > bin1) - 0.5
 *             elif b1 == 0:
 */
            __pyx_v_b1 = (__pyx_v_bin1 - 1);
 267:                 fbin1 = (< double > bin1) - 0.5
            /* "histogram.pyx":267
 *             if b1 == bin1:
 *                 b1 = bin1 - 1
 *                 fbin1 = (< double > bin1) - 0.5             # <<<<<<<<<<<<<<
 *             elif b1 == 0:
 *                 fbin1 = 0.5
 */
            __pyx_v_fbin1 = (((double)__pyx_v_bin1) - 0.5);
            goto __pyx_L38;
          }
 268:             elif b1 == 0:
          /* "histogram.pyx":268
 *                 b1 = bin1 - 1
 *                 fbin1 = (< double > bin1) - 0.5
 *             elif b1 == 0:             # <<<<<<<<<<<<<<
 *                 fbin1 = 0.5
 * 
 */
          __pyx_t_22 = (__pyx_v_b1 == 0);
          if (__pyx_t_22) {
 269:                 fbin1 = 0.5
            /* "histogram.pyx":269
 *                 fbin1 = (< double > bin1) - 0.5
 *             elif b1 == 0:
 *                 fbin1 = 0.5             # <<<<<<<<<<<<<<
 * 
 *             delta0l = fbin0 -< double > b0 - dbin0
 */
            __pyx_v_fbin1 = 0.5;
            goto __pyx_L38;
          }
          __pyx_L38:;
 270: 
 271:             delta0l = fbin0 -< double > b0 - dbin0
          /* "histogram.pyx":271
 *                 fbin1 = 0.5
 * 
 *             delta0l = fbin0 -< double > b0 - dbin0             # <<<<<<<<<<<<<<
 *             delta0r = fbin0 -< double > b0 - 1 + dbin0
 *             delta1l = fbin1 -< double > b1 - dbin1
 */
          __pyx_v_delta0l = ((__pyx_v_fbin0 - ((double)__pyx_v_b0)) - __pyx_v_dbin0);
 272:             delta0r = fbin0 -< double > b0 - 1 + dbin0
          /* "histogram.pyx":272
 * 
 *             delta0l = fbin0 -< double > b0 - dbin0
 *             delta0r = fbin0 -< double > b0 - 1 + dbin0             # <<<<<<<<<<<<<<
 *             delta1l = fbin1 -< double > b1 - dbin1
 *             delta1r = fbin1 -< double > b1 - 1 + dbin1
 */
          __pyx_v_delta0r = (((__pyx_v_fbin0 - ((double)__pyx_v_b0)) - 1.0) + __pyx_v_dbin0);
 273:             delta1l = fbin1 -< double > b1 - dbin1
          /* "histogram.pyx":273
 *             delta0l = fbin0 -< double > b0 - dbin0
 *             delta0r = fbin0 -< double > b0 - 1 + dbin0
 *             delta1l = fbin1 -< double > b1 - dbin1             # <<<<<<<<<<<<<<
 *             delta1r = fbin1 -< double > b1 - 1 + dbin1
 *             rest = 1.0
 */
          __pyx_v_delta1l = ((__pyx_v_fbin1 - ((double)__pyx_v_b1)) - __pyx_v_dbin1);
 274:             delta1r = fbin1 -< double > b1 - 1 + dbin1
          /* "histogram.pyx":274
 *             delta0r = fbin0 -< double > b0 - 1 + dbin0
 *             delta1l = fbin1 -< double > b1 - dbin1
 *             delta1r = fbin1 -< double > b1 - 1 + dbin1             # <<<<<<<<<<<<<<
 *             rest = 1.0
 *             if csplit == 1:
 */
          __pyx_v_delta1r = (((__pyx_v_fbin1 - ((double)__pyx_v_b1)) - 1.0) + __pyx_v_dbin1);
 275:             rest = 1.0
          /* "histogram.pyx":275
 *             delta1l = fbin1 -< double > b1 - dbin1
 *             delta1r = fbin1 -< double > b1 - 1 + dbin1
 *             rest = 1.0             # <<<<<<<<<<<<<<
 *             if csplit == 1:
 *                 if delta0l < 0 and b0 > 0:
 */
          __pyx_v_rest = 1.0;
 276:             if csplit == 1:
          /* "histogram.pyx":276
 *             delta1r = fbin1 -< double > b1 - 1 + dbin1
 *             rest = 1.0
 *             if csplit == 1:             # <<<<<<<<<<<<<<
 *                 if delta0l < 0 and b0 > 0:
 *                     if delta1l < 0 and b1 > 0:
 */
          __pyx_t_22 = (__pyx_v_csplit == 1);
          if (__pyx_t_22) {
 277:                 if delta0l < 0 and b0 > 0:
            /* "histogram.pyx":277
 *             rest = 1.0
 *             if csplit == 1:
 *                 if delta0l < 0 and b0 > 0:             # <<<<<<<<<<<<<<
 *                     if delta1l < 0 and b1 > 0:
 *                         area = delta0l * delta1l
 */
            __pyx_t_22 = (__pyx_v_delta0l < 0.0);
            if (__pyx_t_22) {
              __pyx_t_4 = (__pyx_v_b0 > 0);
              __pyx_t_21 = __pyx_t_4;
            } else {
              __pyx_t_21 = __pyx_t_22;
            }
            if (__pyx_t_21) {
 278:                     if delta1l < 0 and b1 > 0:
              /* "histogram.pyx":278
 *             if csplit == 1:
 *                 if delta0l < 0 and b0 > 0:
 *                     if delta1l < 0 and b1 > 0:             # <<<<<<<<<<<<<<
 *                         area = delta0l * delta1l
 *                         rest -= area
 */
              __pyx_t_21 = (__pyx_v_delta1l < 0.0);
              if (__pyx_t_21) {
                __pyx_t_22 = (__pyx_v_b1 > 0);
                __pyx_t_4 = __pyx_t_22;
              } else {
                __pyx_t_4 = __pyx_t_21;
              }
              if (__pyx_t_4) {
 279:                         area = delta0l * delta1l
                /* "histogram.pyx":279
 *                 if delta0l < 0 and b0 > 0:
 *                     if delta1l < 0 and b1 > 0:
 *                         area = delta0l * delta1l             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 - 1, b1 - 1] += area
 */
                __pyx_v_area = (__pyx_v_delta0l * __pyx_v_delta1l);
 280:                         rest -= area
                /* "histogram.pyx":280
 *                     if delta1l < 0 and b1 > 0:
 *                         area = delta0l * delta1l
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 - 1, b1 - 1] += area
 *                         outData[b0 - 1, b1 - 1] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 281:                         outCount[b0 - 1, b1 - 1] += area
                /* "histogram.pyx":281
 *                         area = delta0l * delta1l
 *                         rest -= area
 *                         outCount[b0 - 1, b1 - 1] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 - 1, b1 - 1] += area * d
 * 
 */
                __pyx_t_28 = (__pyx_v_b0 - 1);
                __pyx_t_29 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_28, __pyx_bstride_0_outCount, __pyx_t_29, __pyx_bstride_1_outCount) += __pyx_v_area;
 282:                         outData[b0 - 1, b1 - 1] += area * d
                /* "histogram.pyx":282
 *                         rest -= area
 *                         outCount[b0 - 1, b1 - 1] += area
 *                         outData[b0 - 1, b1 - 1] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (-delta0l) * (1 + delta1l)
 */
                __pyx_t_30 = (__pyx_v_b0 - 1);
                __pyx_t_31 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_30, __pyx_bstride_0_outData, __pyx_t_31, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 283: 
 284:                         area = (-delta0l) * (1 + delta1l)
                /* "histogram.pyx":284
 *                         outData[b0 - 1, b1 - 1] += area * d
 * 
 *                         area = (-delta0l) * (1 + delta1l)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area
 */
                __pyx_v_area = ((-__pyx_v_delta0l) * (1.0 + __pyx_v_delta1l));
 285:                         rest -= area
                /* "histogram.pyx":285
 * 
 *                         area = (-delta0l) * (1 + delta1l)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 - 1, b1 ] += area
 *                         outData[b0 - 1, b1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 286:                         outCount[b0 - 1, b1 ] += area
                /* "histogram.pyx":286
 *                         area = (-delta0l) * (1 + delta1l)
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 - 1, b1 ] += area * d
 * 
 */
                __pyx_t_32 = (__pyx_v_b0 - 1);
                __pyx_t_33 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_32, __pyx_bstride_0_outCount, __pyx_t_33, __pyx_bstride_1_outCount) += __pyx_v_area;
 287:                         outData[b0 - 1, b1 ] += area * d
                /* "histogram.pyx":287
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area
 *                         outData[b0 - 1, b1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (1 + delta0l) * (-delta1l)
 */
                __pyx_t_34 = (__pyx_v_b0 - 1);
                __pyx_t_35 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_34, __pyx_bstride_0_outData, __pyx_t_35, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 288: 
 289:                         area = (1 + delta0l) * (-delta1l)
                /* "histogram.pyx":289
 *                         outData[b0 - 1, b1 ] += area * d
 * 
 *                         area = (1 + delta0l) * (-delta1l)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area
 */
                __pyx_v_area = ((1.0 + __pyx_v_delta0l) * (-__pyx_v_delta1l));
 290:                         rest -= area
                /* "histogram.pyx":290
 * 
 *                         area = (1 + delta0l) * (-delta1l)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 , b1 - 1 ] += area
 *                         outData[b0 , b1 - 1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 291:                         outCount[b0 , b1 - 1 ] += area
                /* "histogram.pyx":291
 *                         area = (1 + delta0l) * (-delta1l)
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 , b1 - 1 ] += area * d
 * 
 */
                __pyx_t_36 = __pyx_v_b0;
                __pyx_t_37 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_36, __pyx_bstride_0_outCount, __pyx_t_37, __pyx_bstride_1_outCount) += __pyx_v_area;
 292:                         outData[b0 , b1 - 1 ] += area * d
                /* "histogram.pyx":292
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area
 *                         outData[b0 , b1 - 1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 */
                __pyx_t_38 = __pyx_v_b0;
                __pyx_t_39 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_38, __pyx_bstride_0_outData, __pyx_t_39, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
                goto __pyx_L41;
              }
 293: 
 294:                     elif delta1r > 0 and b1 < bin1 - 1:
              /* "histogram.pyx":294
 *                         outData[b0 , b1 - 1 ] += area * d
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:             # <<<<<<<<<<<<<<
 *                         area = -delta0l * delta1r
 *                         rest -= area
 */
              __pyx_t_4 = (__pyx_v_delta1r > 0.0);
              if (__pyx_t_4) {
                __pyx_t_21 = (__pyx_v_b1 < (__pyx_v_bin1 - 1));
                __pyx_t_22 = __pyx_t_21;
              } else {
                __pyx_t_22 = __pyx_t_4;
              }
              if (__pyx_t_22) {
 295:                         area = -delta0l * delta1r
                /* "histogram.pyx":295
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 *                         area = -delta0l * delta1r             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 - 1, b1 + 1] += area
 */
                __pyx_v_area = ((-__pyx_v_delta0l) * __pyx_v_delta1r);
 296:                         rest -= area
                /* "histogram.pyx":296
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 *                         area = -delta0l * delta1r
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 - 1, b1 + 1] += area
 *                         outData[b0 - 1, b1 + 1] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 297:                         outCount[b0 - 1, b1 + 1] += area
                /* "histogram.pyx":297
 *                         area = -delta0l * delta1r
 *                         rest -= area
 *                         outCount[b0 - 1, b1 + 1] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 - 1, b1 + 1] += area * d
 * 
 */
                __pyx_t_40 = (__pyx_v_b0 - 1);
                __pyx_t_41 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_40, __pyx_bstride_0_outCount, __pyx_t_41, __pyx_bstride_1_outCount) += __pyx_v_area;
 298:                         outData[b0 - 1, b1 + 1] += area * d
                /* "histogram.pyx":298
 *                         rest -= area
 *                         outCount[b0 - 1, b1 + 1] += area
 *                         outData[b0 - 1, b1 + 1] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (-delta0l) * (1 - delta1r)
 */
                __pyx_t_42 = (__pyx_v_b0 - 1);
                __pyx_t_43 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_42, __pyx_bstride_0_outData, __pyx_t_43, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 299: 
 300:                         area = (-delta0l) * (1 - delta1r)
                /* "histogram.pyx":300
 *                         outData[b0 - 1, b1 + 1] += area * d
 * 
 *                         area = (-delta0l) * (1 - delta1r)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area
 */
                __pyx_v_area = ((-__pyx_v_delta0l) * (1.0 - __pyx_v_delta1r));
 301:                         rest -= area
                /* "histogram.pyx":301
 * 
 *                         area = (-delta0l) * (1 - delta1r)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 - 1, b1 ] += area
 *                         outData[b0 - 1, b1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 302:                         outCount[b0 - 1, b1 ] += area
                /* "histogram.pyx":302
 *                         area = (-delta0l) * (1 - delta1r)
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 - 1, b1 ] += area * d
 * 
 */
                __pyx_t_44 = (__pyx_v_b0 - 1);
                __pyx_t_45 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_44, __pyx_bstride_0_outCount, __pyx_t_45, __pyx_bstride_1_outCount) += __pyx_v_area;
 303:                         outData[b0 - 1, b1 ] += area * d
                /* "histogram.pyx":303
 *                         rest -= area
 *                         outCount[b0 - 1, b1 ] += area
 *                         outData[b0 - 1, b1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (1 + delta0l) * (delta1r)
 */
                __pyx_t_46 = (__pyx_v_b0 - 1);
                __pyx_t_47 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_46, __pyx_bstride_0_outData, __pyx_t_47, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 304: 
 305:                         area = (1 + delta0l) * (delta1r)
                /* "histogram.pyx":305
 *                         outData[b0 - 1, b1 ] += area * d
 * 
 *                         area = (1 + delta0l) * (delta1r)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area
 */
                __pyx_v_area = ((1.0 + __pyx_v_delta0l) * __pyx_v_delta1r);
 306:                         rest -= area
                /* "histogram.pyx":306
 * 
 *                         area = (1 + delta0l) * (delta1r)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 307:                         outCount[b0 , b1 + 1 ] += area
                /* "histogram.pyx":307
 *                         area = (1 + delta0l) * (delta1r)
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 , b1 + 1 ] += area * d
 *                 elif delta0r > 0 and b0 < bin0 - 1:
 */
                __pyx_t_48 = __pyx_v_b0;
                __pyx_t_49 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_48, __pyx_bstride_0_outCount, __pyx_t_49, __pyx_bstride_1_outCount) += __pyx_v_area;
 308:                         outData[b0 , b1 + 1 ] += area * d
                /* "histogram.pyx":308
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d             # <<<<<<<<<<<<<<
 *                 elif delta0r > 0 and b0 < bin0 - 1:
 *                     if delta1l < 0 and b1 > 0:
 */
                __pyx_t_50 = __pyx_v_b0;
                __pyx_t_51 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_50, __pyx_bstride_0_outData, __pyx_t_51, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
                goto __pyx_L41;
              }
              __pyx_L41:;
              goto __pyx_L40;
            }
 309:                 elif delta0r > 0 and b0 < bin0 - 1:
            /* "histogram.pyx":309
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d
 *                 elif delta0r > 0 and b0 < bin0 - 1:             # <<<<<<<<<<<<<<
 *                     if delta1l < 0 and b1 > 0:
 *                         area = -delta0r * delta1l
 */
            __pyx_t_22 = (__pyx_v_delta0r > 0.0);
            if (__pyx_t_22) {
              __pyx_t_4 = (__pyx_v_b0 < (__pyx_v_bin0 - 1));
              __pyx_t_21 = __pyx_t_4;
            } else {
              __pyx_t_21 = __pyx_t_22;
            }
            if (__pyx_t_21) {
 310:                     if delta1l < 0 and b1 > 0:
              /* "histogram.pyx":310
 *                         outData[b0 , b1 + 1 ] += area * d
 *                 elif delta0r > 0 and b0 < bin0 - 1:
 *                     if delta1l < 0 and b1 > 0:             # <<<<<<<<<<<<<<
 *                         area = -delta0r * delta1l
 *                         rest -= area
 */
              __pyx_t_21 = (__pyx_v_delta1l < 0.0);
              if (__pyx_t_21) {
                __pyx_t_22 = (__pyx_v_b1 > 0);
                __pyx_t_4 = __pyx_t_22;
              } else {
                __pyx_t_4 = __pyx_t_21;
              }
              if (__pyx_t_4) {
 311:                         area = -delta0r * delta1l
                /* "histogram.pyx":311
 *                 elif delta0r > 0 and b0 < bin0 - 1:
 *                     if delta1l < 0 and b1 > 0:
 *                         area = -delta0r * delta1l             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 + 1, b1 - 1] += area
 */
                __pyx_v_area = ((-__pyx_v_delta0r) * __pyx_v_delta1l);
 312:                         rest -= area
                /* "histogram.pyx":312
 *                     if delta1l < 0 and b1 > 0:
 *                         area = -delta0r * delta1l
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 + 1, b1 - 1] += area
 *                         outData[b0 + 1, b1 - 1] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 313:                         outCount[b0 + 1, b1 - 1] += area
                /* "histogram.pyx":313
 *                         area = -delta0r * delta1l
 *                         rest -= area
 *                         outCount[b0 + 1, b1 - 1] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 + 1, b1 - 1] += area * d
 * 
 */
                __pyx_t_52 = (__pyx_v_b0 + 1);
                __pyx_t_53 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_52, __pyx_bstride_0_outCount, __pyx_t_53, __pyx_bstride_1_outCount) += __pyx_v_area;
 314:                         outData[b0 + 1, b1 - 1] += area * d
                /* "histogram.pyx":314
 *                         rest -= area
 *                         outCount[b0 + 1, b1 - 1] += area
 *                         outData[b0 + 1, b1 - 1] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (delta0r) * (1 + delta1l)
 */
                __pyx_t_54 = (__pyx_v_b0 + 1);
                __pyx_t_55 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_54, __pyx_bstride_0_outData, __pyx_t_55, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 315: 
 316:                         area = (delta0r) * (1 + delta1l)
                /* "histogram.pyx":316
 *                         outData[b0 + 1, b1 - 1] += area * d
 * 
 *                         area = (delta0r) * (1 + delta1l)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area
 */
                __pyx_v_area = (__pyx_v_delta0r * (1.0 + __pyx_v_delta1l));
 317:                         rest -= area
                /* "histogram.pyx":317
 * 
 *                         area = (delta0r) * (1 + delta1l)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 + 1, b1 ] += area
 *                         outData[b0 + 1, b1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 318:                         outCount[b0 + 1, b1 ] += area
                /* "histogram.pyx":318
 *                         area = (delta0r) * (1 + delta1l)
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 + 1, b1 ] += area * d
 * 
 */
                __pyx_t_56 = (__pyx_v_b0 + 1);
                __pyx_t_57 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_56, __pyx_bstride_0_outCount, __pyx_t_57, __pyx_bstride_1_outCount) += __pyx_v_area;
 319:                         outData[b0 + 1, b1 ] += area * d
                /* "histogram.pyx":319
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area
 *                         outData[b0 + 1, b1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (1 - delta0r) * (-delta1l)
 */
                __pyx_t_58 = (__pyx_v_b0 + 1);
                __pyx_t_59 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_58, __pyx_bstride_0_outData, __pyx_t_59, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 320: 
 321:                         area = (1 - delta0r) * (-delta1l)
                /* "histogram.pyx":321
 *                         outData[b0 + 1, b1 ] += area * d
 * 
 *                         area = (1 - delta0r) * (-delta1l)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area
 */
                __pyx_v_area = ((1.0 - __pyx_v_delta0r) * (-__pyx_v_delta1l));
 322:                         rest -= area
                /* "histogram.pyx":322
 * 
 *                         area = (1 - delta0r) * (-delta1l)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 , b1 - 1 ] += area
 *                         outData[b0 , b1 - 1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 323:                         outCount[b0 , b1 - 1 ] += area
                /* "histogram.pyx":323
 *                         area = (1 - delta0r) * (-delta1l)
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 , b1 - 1 ] += area * d
 * 
 */
                __pyx_t_60 = __pyx_v_b0;
                __pyx_t_61 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_60, __pyx_bstride_0_outCount, __pyx_t_61, __pyx_bstride_1_outCount) += __pyx_v_area;
 324:                         outData[b0 , b1 - 1 ] += area * d
                /* "histogram.pyx":324
 *                         rest -= area
 *                         outCount[b0 , b1 - 1 ] += area
 *                         outData[b0 , b1 - 1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 */
                __pyx_t_62 = __pyx_v_b0;
                __pyx_t_63 = (__pyx_v_b1 - 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_62, __pyx_bstride_0_outData, __pyx_t_63, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
                goto __pyx_L42;
              }
 325: 
 326:                     elif delta1r > 0 and b1 < bin1 - 1:
              /* "histogram.pyx":326
 *                         outData[b0 , b1 - 1 ] += area * d
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:             # <<<<<<<<<<<<<<
 *                         area = delta0r * delta1r
 *                         rest -= area
 */
              __pyx_t_4 = (__pyx_v_delta1r > 0.0);
              if (__pyx_t_4) {
                __pyx_t_21 = (__pyx_v_b1 < (__pyx_v_bin1 - 1));
                __pyx_t_22 = __pyx_t_21;
              } else {
                __pyx_t_22 = __pyx_t_4;
              }
              if (__pyx_t_22) {
 327:                         area = delta0r * delta1r
                /* "histogram.pyx":327
 * 
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 *                         area = delta0r * delta1r             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 + 1, b1 + 1] += area
 */
                __pyx_v_area = (__pyx_v_delta0r * __pyx_v_delta1r);
 328:                         rest -= area
                /* "histogram.pyx":328
 *                     elif delta1r > 0 and b1 < bin1 - 1:
 *                         area = delta0r * delta1r
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 + 1, b1 + 1] += area
 *                         outData[b0 + 1, b1 + 1] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 329:                         outCount[b0 + 1, b1 + 1] += area
                /* "histogram.pyx":329
 *                         area = delta0r * delta1r
 *                         rest -= area
 *                         outCount[b0 + 1, b1 + 1] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 + 1, b1 + 1] += area * d
 * 
 */
                __pyx_t_64 = (__pyx_v_b0 + 1);
                __pyx_t_65 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_64, __pyx_bstride_0_outCount, __pyx_t_65, __pyx_bstride_1_outCount) += __pyx_v_area;
 330:                         outData[b0 + 1, b1 + 1] += area * d
                /* "histogram.pyx":330
 *                         rest -= area
 *                         outCount[b0 + 1, b1 + 1] += area
 *                         outData[b0 + 1, b1 + 1] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (delta0r) * (1 - delta1r)
 */
                __pyx_t_66 = (__pyx_v_b0 + 1);
                __pyx_t_67 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_66, __pyx_bstride_0_outData, __pyx_t_67, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 331: 
 332:                         area = (delta0r) * (1 - delta1r)
                /* "histogram.pyx":332
 *                         outData[b0 + 1, b1 + 1] += area * d
 * 
 *                         area = (delta0r) * (1 - delta1r)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area
 */
                __pyx_v_area = (__pyx_v_delta0r * (1.0 - __pyx_v_delta1r));
 333:                         rest -= area
                /* "histogram.pyx":333
 * 
 *                         area = (delta0r) * (1 - delta1r)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 + 1, b1 ] += area
 *                         outData[b0 + 1, b1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 334:                         outCount[b0 + 1, b1 ] += area
                /* "histogram.pyx":334
 *                         area = (delta0r) * (1 - delta1r)
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 + 1, b1 ] += area * d
 * 
 */
                __pyx_t_68 = (__pyx_v_b0 + 1);
                __pyx_t_69 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_68, __pyx_bstride_0_outCount, __pyx_t_69, __pyx_bstride_1_outCount) += __pyx_v_area;
 335:                         outData[b0 + 1, b1 ] += area * d
                /* "histogram.pyx":335
 *                         rest -= area
 *                         outCount[b0 + 1, b1 ] += area
 *                         outData[b0 + 1, b1 ] += area * d             # <<<<<<<<<<<<<<
 * 
 *                         area = (1 - delta0r) * (delta1r)
 */
                __pyx_t_70 = (__pyx_v_b0 + 1);
                __pyx_t_71 = __pyx_v_b1;
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_70, __pyx_bstride_0_outData, __pyx_t_71, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
 336: 
 337:                         area = (1 - delta0r) * (delta1r)
                /* "histogram.pyx":337
 *                         outData[b0 + 1, b1 ] += area * d
 * 
 *                         area = (1 - delta0r) * (delta1r)             # <<<<<<<<<<<<<<
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area
 */
                __pyx_v_area = ((1.0 - __pyx_v_delta0r) * __pyx_v_delta1r);
 338:                         rest -= area
                /* "histogram.pyx":338
 * 
 *                         area = (1 - delta0r) * (delta1r)
 *                         rest -= area             # <<<<<<<<<<<<<<
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d
 */
                __pyx_v_rest = (__pyx_v_rest - __pyx_v_area);
 339:                         outCount[b0 , b1 + 1 ] += area
                /* "histogram.pyx":339
 *                         area = (1 - delta0r) * (delta1r)
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area             # <<<<<<<<<<<<<<
 *                         outData[b0 , b1 + 1 ] += area * d
 *             outCount[b0, b1] += rest
 */
                __pyx_t_72 = __pyx_v_b0;
                __pyx_t_73 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_72, __pyx_bstride_0_outCount, __pyx_t_73, __pyx_bstride_1_outCount) += __pyx_v_area;
 340:                         outData[b0 , b1 + 1 ] += area * d
                /* "histogram.pyx":340
 *                         rest -= area
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d             # <<<<<<<<<<<<<<
 *             outCount[b0, b1] += rest
 *             outData[b0, b1] += d * rest
 */
                __pyx_t_74 = __pyx_v_b0;
                __pyx_t_75 = (__pyx_v_b1 + 1);
                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_74, __pyx_bstride_0_outData, __pyx_t_75, __pyx_bstride_1_outData) += (__pyx_v_area * __pyx_v_d);
                goto __pyx_L42;
              }
              __pyx_L42:;
              goto __pyx_L40;
            }
            __pyx_L40:;
            goto __pyx_L39;
          }
          __pyx_L39:;
 341:             outCount[b0, b1] += rest
          /* "histogram.pyx":341
 *                         outCount[b0 , b1 + 1 ] += area
 *                         outData[b0 , b1 + 1 ] += area * d
 *             outCount[b0, b1] += rest             # <<<<<<<<<<<<<<
 *             outData[b0, b1] += d * rest
 * 
 */
          __pyx_t_76 = __pyx_v_b0;
          __pyx_t_77 = __pyx_v_b1;
          *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_76, __pyx_bstride_0_outCount, __pyx_t_77, __pyx_bstride_1_outCount) += __pyx_v_rest;
 342:             outData[b0, b1] += d * rest
          /* "histogram.pyx":342
 *                         outData[b0 , b1 + 1 ] += area * d
 *             outCount[b0, b1] += rest
 *             outData[b0, b1] += d * rest             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(bin0):
 */
          __pyx_t_78 = __pyx_v_b0;
          __pyx_t_79 = __pyx_v_b1;
          *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_78, __pyx_bstride_0_outData, __pyx_t_79, __pyx_bstride_1_outData) += (__pyx_v_d * __pyx_v_rest);
        }
 343: 
 344:         for i in prange(bin0):
        /* "histogram.pyx":344
 *             outData[b0, b1] += d * rest
 * 
 *         for i in prange(bin0):             # <<<<<<<<<<<<<<
 *             for j in range(bin1):
 *                 if outCount[i, j] > 1e-10:
 */
        __pyx_t_9 = __pyx_v_bin0;
        if (1 == 0) abort();
        {
            __pyx_t_80 = (__pyx_t_9 - 0) / 1;
            if (__pyx_t_80 > 0)
            {
                __pyx_v_i = 0;
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_j) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i)
                    #endif /* _OPENMP */
                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_80; __pyx_t_5++){
                        {
                            __pyx_v_i = 0 + 1 * __pyx_t_5;
                            /* Initialize private variables to invalid values */
                            __pyx_v_j = ((long)0xbad0bad0);
 345:             for j in range(bin1):
                            /* "histogram.pyx":345
 * 
 *         for i in prange(bin0):
 *             for j in range(bin1):             # <<<<<<<<<<<<<<
 *                 if outCount[i, j] > 1e-10:
 *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
 */
                            __pyx_t_81 = __pyx_v_bin1;
                            for (__pyx_t_82 = 0; __pyx_t_82 < __pyx_t_81; __pyx_t_82+=1) {
                              __pyx_v_j = __pyx_t_82;
 346:                 if outCount[i, j] > 1e-10:
                              /* "histogram.pyx":346
 *         for i in prange(bin0):
 *             for j in range(bin1):
 *                 if outCount[i, j] > 1e-10:             # <<<<<<<<<<<<<<
 *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
 *                 else:
 */
                              __pyx_t_83 = __pyx_v_i;
                              __pyx_t_84 = __pyx_v_j;
                              __pyx_t_22 = ((*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_83, __pyx_bstride_0_outCount, __pyx_t_84, __pyx_bstride_1_outCount)) > 1e-10);
                              if (__pyx_t_22) {
 347:                     outMerge[i, j] += outData[i, j] / outCount[i, j]
                                /* "histogram.pyx":347
 *             for j in range(bin1):
 *                 if outCount[i, j] > 1e-10:
 *                     outMerge[i, j] += outData[i, j] / outCount[i, j]             # <<<<<<<<<<<<<<
 *                 else:
 *                     outMerge[i, j] += dummy
 */
                                __pyx_t_85 = __pyx_v_i;
                                __pyx_t_86 = __pyx_v_j;
                                __pyx_t_87 = __pyx_v_i;
                                __pyx_t_88 = __pyx_v_j;
                                __pyx_t_89 = __pyx_v_i;
                                __pyx_t_90 = __pyx_v_j;
                                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_89, __pyx_bstride_0_outMerge, __pyx_t_90, __pyx_bstride_1_outMerge) += ((*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_85, __pyx_bstride_0_outData, __pyx_t_86, __pyx_bstride_1_outData)) / (*__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_87, __pyx_bstride_0_outCount, __pyx_t_88, __pyx_bstride_1_outCount)));
                                goto __pyx_L49;
                              }
                              /*else*/ {
 348:                 else:
 349:                     outMerge[i, j] += dummy
                                /* "histogram.pyx":349
 *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
 *                 else:
 *                     outMerge[i, j] += dummy             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                __pyx_t_91 = __pyx_v_i;
                                __pyx_t_92 = __pyx_v_j;
                                *__Pyx_BufPtrStrided2d(__pyx_t_9histogram_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_91, __pyx_bstride_0_outMerge, __pyx_t_92, __pyx_bstride_1_outMerge) += __pyx_v_dummy;
                              }
                              __pyx_L49:;
                            }
                        }
                    }
                }
            }
        }
      }
 350: 
 351: 
 352:     return outMerge, edges0, edges1, outData, outCount
  /* "histogram.pyx":352
 * 
 * 
 *     return outMerge, edges0, edges1, outData, outCount             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_14 = PyTuple_New(5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
  PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_v_edges0));
  PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_v_edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0));
  __Pyx_INCREF(((PyObject *)__pyx_v_edges1));
  PyTuple_SET_ITEM(__pyx_t_14, 2, ((PyObject *)__pyx_v_edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1));
  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
  PyTuple_SET_ITEM(__pyx_t_14, 3, ((PyObject *)__pyx_v_outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
  PyTuple_SET_ITEM(__pyx_t_14, 4, ((PyObject *)__pyx_v_outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
  __pyx_r = ((PyObject *)__pyx_t_14);
  __pyx_t_14 = 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_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos1);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos0);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("histogram.histogram2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos1);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos0);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0);
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1);
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges0);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
pyfai-0.3.5/src/xutils.c0000644001611600065110000100552111645660757014311 0ustar kieffersoft/* Generated by Cython 0.15.1+ on Fri Oct 14 00:10:55 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif /* new Py3.3 unicode representation (PEP 393) */ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) #define CYTHON_PEP393_ENABLED #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #else #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__xutils #define __PYX_HAVE_API__xutils #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "xutils.pyx", "numpy.pxd", }; /* "numpy.pxd":719 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":720 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":721 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":722 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":726 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":727 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":728 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":729 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":733 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":734 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":743 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":744 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":745 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":747 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":748 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":749 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":751 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":752 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":754 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":755 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":756 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "xutils.pyx":31 * import numpy * * ctypedef numpy.int64_t DTYPE_int64_t # <<<<<<<<<<<<<< * ctypedef numpy.float64_t DTYPE_float64_t * */ typedef __pyx_t_5numpy_int64_t __pyx_t_6xutils_DTYPE_int64_t; /* "xutils.pyx":32 * * ctypedef numpy.int64_t DTYPE_int64_t * ctypedef numpy.float64_t DTYPE_float64_t # <<<<<<<<<<<<<< * * def boundingBox(data): */ typedef __pyx_t_5numpy_float64_t __pyx_t_6xutils_DTYPE_float64_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":758 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":759 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":760 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":762 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ /* Run-time type information about structs used with buffers */ struct __Pyx_StructField_; typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); } else { r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } return r; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif Py_ssize_t __Pyx_zeros[] = {0}; Py_ssize_t __Pyx_minusones[] = {-1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'xutils' */ static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), 'I' }; #define __Pyx_MODULE_NAME "xutils" int __pyx_module_is_main_xutils = 0; /* Implementation of 'xutils' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ValueError; static char __pyx_k_1[] = "Dimensions > 4 not implemented"; static char __pyx_k_3[] = "ndarray is not C contiguous"; static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; static char __pyx_k_7[] = "Non-native byte order not supported"; static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_13[] = "Format string allocated too short."; static char __pyx_k_17[] = "/home/jerome/workspace/azimuthal/pyFAI/src/xutils.pyx"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__data[] = "data"; static char __pyx_k__maxs[] = "maxs"; static char __pyx_k__mins[] = "mins"; static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__array[] = "array"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__ndims[] = "ndims"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__shape[] = "shape"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__xutils[] = "xutils"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__boundingBox[] = "boundingBox"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_s_17; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__array; static PyObject *__pyx_n_s__boundingBox; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__k; static PyObject *__pyx_n_s__l; static PyObject *__pyx_n_s__maxs; static PyObject *__pyx_n_s__mins; static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__ndims; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__xutils; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_codeobj_16; /* "xutils.pyx":34 * ctypedef numpy.float64_t DTYPE_float64_t * * def boundingBox(data): # <<<<<<<<<<<<<< * """ * Calculate bounding box around */ static PyObject *__pyx_pf_6xutils_boundingBox(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/ static char __pyx_doc_6xutils_boundingBox[] = "\n Calculate bounding box around \n\n @param img: 2D array like\n @return: 4-typle (d0_min, d1_min, d0_max, d1_max)\n \n \n NOTA: Does not work :( \n \n "; static PyMethodDef __pyx_mdef_6xutils_boundingBox = {__Pyx_NAMESTR("boundingBox"), (PyCFunction)__pyx_pf_6xutils_boundingBox, METH_O, __Pyx_DOCSTR(__pyx_doc_6xutils_boundingBox)}; static PyObject *__pyx_pf_6xutils_boundingBox(PyObject *__pyx_self, PyObject *__pyx_v_data) { PyArrayObject *__pyx_v_shape = 0; long __pyx_v_ndims; PyArrayObject *__pyx_v_mins = 0; PyArrayObject *__pyx_v_maxs = 0; long __pyx_v_i; long __pyx_v_j; long __pyx_v_k; long __pyx_v_l; Py_buffer __pyx_bstruct_maxs; Py_ssize_t __pyx_bstride_0_maxs = 0; Py_ssize_t __pyx_bshape_0_maxs = 0; Py_buffer __pyx_bstruct_shape; Py_ssize_t __pyx_bstride_0_shape = 0; Py_ssize_t __pyx_bshape_0_shape = 0; Py_buffer __pyx_bstruct_mins; Py_ssize_t __pyx_bstride_0_mins = 0; Py_ssize_t __pyx_bshape_0_mins = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyArrayObject *__pyx_t_4 = NULL; long __pyx_t_5; PyArrayObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; int __pyx_t_9; long __pyx_t_10; long __pyx_t_11; int __pyx_t_12; long __pyx_t_13; long __pyx_t_14; long __pyx_t_15; long __pyx_t_16; long __pyx_t_17; long __pyx_t_18; long __pyx_t_19; long __pyx_t_20; long __pyx_t_21; long __pyx_t_22; long __pyx_t_23; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; long __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; long __pyx_t_37; long __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; long __pyx_t_44; long __pyx_t_45; long __pyx_t_46; long __pyx_t_47; long __pyx_t_48; long __pyx_t_49; long __pyx_t_50; long __pyx_t_51; PyObject *__pyx_t_52 = NULL; long __pyx_t_53; long __pyx_t_54; long __pyx_t_55; long __pyx_t_56; long __pyx_t_57; long __pyx_t_58; long __pyx_t_59; long __pyx_t_60; long __pyx_t_61; long __pyx_t_62; long __pyx_t_63; long __pyx_t_64; long __pyx_t_65; long __pyx_t_66; long __pyx_t_67; long __pyx_t_68; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("boundingBox"); __pyx_self = __pyx_self; __pyx_bstruct_shape.buf = NULL; __pyx_bstruct_mins.buf = NULL; __pyx_bstruct_maxs.buf = NULL; /* "xutils.pyx":45 * * """ * cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape) # <<<<<<<<<<<<<< * cdef long ndims = data.ndim * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shape, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_shape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_shape.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_shape = __pyx_bstruct_shape.strides[0]; __pyx_bshape_0_shape = __pyx_bstruct_shape.shape[0]; } } __pyx_t_4 = 0; __pyx_v_shape = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "xutils.pyx":46 * """ * cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape) * cdef long ndims = data.ndim # <<<<<<<<<<<<<< * * # cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ndims = __pyx_t_5; /* "xutils.pyx":49 * * # cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float) * cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape) # <<<<<<<<<<<<<< * cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int) * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_shape)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_shape)); __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mins, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_mins = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_mins.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_mins = __pyx_bstruct_mins.strides[0]; __pyx_bshape_0_mins = __pyx_bstruct_mins.shape[0]; } } __pyx_t_6 = 0; __pyx_v_mins = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "xutils.pyx":50 * # cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float) * cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape) * cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int) # <<<<<<<<<<<<<< * * */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_ndims); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxs, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_maxs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxs.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_maxs = __pyx_bstruct_maxs.strides[0]; __pyx_bshape_0_maxs = __pyx_bstruct_maxs.shape[0]; } } __pyx_t_8 = 0; __pyx_v_maxs = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "xutils.pyx":53 * * * cdef long i = 0 # <<<<<<<<<<<<<< * cdef long j = 0 * cdef long k = 0 */ __pyx_v_i = 0; /* "xutils.pyx":54 * * cdef long i = 0 * cdef long j = 0 # <<<<<<<<<<<<<< * cdef long k = 0 * cdef long l = 0 */ __pyx_v_j = 0; /* "xutils.pyx":55 * cdef long i = 0 * cdef long j = 0 * cdef long k = 0 # <<<<<<<<<<<<<< * cdef long l = 0 * # cdef DTYPE_float64_t x = 0.0 */ __pyx_v_k = 0; /* "xutils.pyx":56 * cdef long j = 0 * cdef long k = 0 * cdef long l = 0 # <<<<<<<<<<<<<< * # cdef DTYPE_float64_t x = 0.0 * # cdef DTYPE_float64_t zero64 = 0.0 */ __pyx_v_l = 0; /* "xutils.pyx":98 * if k > maxs[2]: * maxs[2] = i * elif ndims == 4: # <<<<<<<<<<<<<< * # with nogil: * for i in range(shape[0]): */ switch (__pyx_v_ndims) { /* "xutils.pyx":59 * # cdef DTYPE_float64_t x = 0.0 * # cdef DTYPE_float64_t zero64 = 0.0 * if ndims == 1: # <<<<<<<<<<<<<< * # with nogil: * for i in range(shape[0]): */ case 1: /* "xutils.pyx":61 * if ndims == 1: * # with nogil: * for i in range(shape[0]): # <<<<<<<<<<<<<< * if data[i] > 0.0: * if i < mins[0]: */ __pyx_t_5 = 0; __pyx_t_9 = -1; if (__pyx_t_5 < 0) { __pyx_t_5 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_5 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_5, __pyx_bstride_0_shape)); for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "xutils.pyx":62 * # with nogil: * for i in range(shape[0]): * if data[i] > 0.0: # <<<<<<<<<<<<<< * if i < mins[0]: * mins[0] = i */ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_12) { /* "xutils.pyx":63 * for i in range(shape[0]): * if data[i] > 0.0: * if i < mins[0]: # <<<<<<<<<<<<<< * mins[0] = i * if i > maxs[0]: */ __pyx_t_13 = 0; __pyx_t_9 = -1; if (__pyx_t_13 < 0) { __pyx_t_13 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_13, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":64 * if data[i] > 0.0: * if i < mins[0]: * mins[0] = i # <<<<<<<<<<<<<< * if i > maxs[0]: * maxs[0] = i */ __pyx_t_14 = 0; __pyx_t_9 = -1; if (__pyx_t_14 < 0) { __pyx_t_14 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_14, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L8; } __pyx_L8:; /* "xutils.pyx":65 * if i < mins[0]: * mins[0] = i * if i > maxs[0]: # <<<<<<<<<<<<<< * maxs[0] = i * elif ndims == 2: */ __pyx_t_15 = 0; __pyx_t_9 = -1; if (__pyx_t_15 < 0) { __pyx_t_15 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_15, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":66 * mins[0] = i * if i > maxs[0]: * maxs[0] = i # <<<<<<<<<<<<<< * elif ndims == 2: * # with nogil: */ __pyx_t_16 = 0; __pyx_t_9 = -1; if (__pyx_t_16 < 0) { __pyx_t_16 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_16, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L9; } __pyx_L9:; goto __pyx_L7; } __pyx_L7:; } break; /* "xutils.pyx":67 * if i > maxs[0]: * maxs[0] = i * elif ndims == 2: # <<<<<<<<<<<<<< * # with nogil: * for i in range(shape[0]): */ case 2: /* "xutils.pyx":69 * elif ndims == 2: * # with nogil: * for i in range(shape[0]): # <<<<<<<<<<<<<< * for j in range(shape[1]): * if data[i, j] > 0.0 : */ __pyx_t_10 = 0; __pyx_t_9 = -1; if (__pyx_t_10 < 0) { __pyx_t_10 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_11 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_10, __pyx_bstride_0_shape)); for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_11; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; /* "xutils.pyx":70 * # with nogil: * for i in range(shape[0]): * for j in range(shape[1]): # <<<<<<<<<<<<<< * if data[i, j] > 0.0 : * if i < mins[0]: */ __pyx_t_18 = 1; __pyx_t_9 = -1; if (__pyx_t_18 < 0) { __pyx_t_18 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_18, __pyx_bstride_0_shape)); for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { __pyx_v_j = __pyx_t_20; /* "xutils.pyx":71 * for i in range(shape[0]): * for j in range(shape[1]): * if data[i, j] > 0.0 : # <<<<<<<<<<<<<< * if i < mins[0]: * mins[0] = i */ __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_7)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_12) { /* "xutils.pyx":72 * for j in range(shape[1]): * if data[i, j] > 0.0 : * if i < mins[0]: # <<<<<<<<<<<<<< * mins[0] = i * if i > maxs[0]: */ __pyx_t_21 = 0; __pyx_t_9 = -1; if (__pyx_t_21 < 0) { __pyx_t_21 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_21, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":73 * if data[i, j] > 0.0 : * if i < mins[0]: * mins[0] = i # <<<<<<<<<<<<<< * if i > maxs[0]: * maxs[0] = i */ __pyx_t_22 = 0; __pyx_t_9 = -1; if (__pyx_t_22 < 0) { __pyx_t_22 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_22 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_22, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L15; } __pyx_L15:; /* "xutils.pyx":74 * if i < mins[0]: * mins[0] = i * if i > maxs[0]: # <<<<<<<<<<<<<< * maxs[0] = i * if j < mins[1]: */ __pyx_t_23 = 0; __pyx_t_9 = -1; if (__pyx_t_23 < 0) { __pyx_t_23 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_23, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":75 * mins[0] = i * if i > maxs[0]: * maxs[0] = i # <<<<<<<<<<<<<< * if j < mins[1]: * mins[1] = i */ __pyx_t_24 = 0; __pyx_t_9 = -1; if (__pyx_t_24 < 0) { __pyx_t_24 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_24, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L16; } __pyx_L16:; /* "xutils.pyx":76 * if i > maxs[0]: * maxs[0] = i * if j < mins[1]: # <<<<<<<<<<<<<< * mins[1] = i * if j > maxs[1]: */ __pyx_t_25 = 1; __pyx_t_9 = -1; if (__pyx_t_25 < 0) { __pyx_t_25 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_25 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_25, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":77 * maxs[0] = i * if j < mins[1]: * mins[1] = i # <<<<<<<<<<<<<< * if j > maxs[1]: * maxs[1] = i */ __pyx_t_26 = 1; __pyx_t_9 = -1; if (__pyx_t_26 < 0) { __pyx_t_26 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_26 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_26, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L17; } __pyx_L17:; /* "xutils.pyx":78 * if j < mins[1]: * mins[1] = i * if j > maxs[1]: # <<<<<<<<<<<<<< * maxs[1] = i * elif ndims == 3: */ __pyx_t_27 = 1; __pyx_t_9 = -1; if (__pyx_t_27 < 0) { __pyx_t_27 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_27 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_27, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":79 * mins[1] = i * if j > maxs[1]: * maxs[1] = i # <<<<<<<<<<<<<< * elif ndims == 3: * # with nogil: */ __pyx_t_28 = 1; __pyx_t_9 = -1; if (__pyx_t_28 < 0) { __pyx_t_28 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_28, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L18; } __pyx_L18:; goto __pyx_L14; } __pyx_L14:; } } break; /* "xutils.pyx":80 * if j > maxs[1]: * maxs[1] = i * elif ndims == 3: # <<<<<<<<<<<<<< * # with nogil: * for i in range(shape[0]): */ case 3: /* "xutils.pyx":82 * elif ndims == 3: * # with nogil: * for i in range(shape[0]): # <<<<<<<<<<<<<< * for j in range(shape[1]): * for k in range(shape[2]): */ __pyx_t_11 = 0; __pyx_t_9 = -1; if (__pyx_t_11 < 0) { __pyx_t_11 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_11, __pyx_bstride_0_shape)); for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) { __pyx_v_i = __pyx_t_19; /* "xutils.pyx":83 * # with nogil: * for i in range(shape[0]): * for j in range(shape[1]): # <<<<<<<<<<<<<< * for k in range(shape[2]): * if data[i, j, k] > 0.0: */ __pyx_t_20 = 1; __pyx_t_9 = -1; if (__pyx_t_20 < 0) { __pyx_t_20 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_29 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_20, __pyx_bstride_0_shape)); for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) { __pyx_v_j = __pyx_t_30; /* "xutils.pyx":84 * for i in range(shape[0]): * for j in range(shape[1]): * for k in range(shape[2]): # <<<<<<<<<<<<<< * if data[i, j, k] > 0.0: * if i < mins[0]: */ __pyx_t_31 = 2; __pyx_t_9 = -1; if (__pyx_t_31 < 0) { __pyx_t_31 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_32 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_31, __pyx_bstride_0_shape)); for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { __pyx_v_k = __pyx_t_33; /* "xutils.pyx":85 * for j in range(shape[1]): * for k in range(shape[2]): * if data[i, j, k] > 0.0: # <<<<<<<<<<<<<< * if i < mins[0]: * mins[0] = i */ __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __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 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_12) { /* "xutils.pyx":86 * for k in range(shape[2]): * if data[i, j, k] > 0.0: * if i < mins[0]: # <<<<<<<<<<<<<< * mins[0] = i * if i > maxs[0]: */ __pyx_t_34 = 0; __pyx_t_9 = -1; if (__pyx_t_34 < 0) { __pyx_t_34 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_34 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_34, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":87 * if data[i, j, k] > 0.0: * if i < mins[0]: * mins[0] = i # <<<<<<<<<<<<<< * if i > maxs[0]: * maxs[0] = i */ __pyx_t_35 = 0; __pyx_t_9 = -1; if (__pyx_t_35 < 0) { __pyx_t_35 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_35 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_35, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L26; } __pyx_L26:; /* "xutils.pyx":88 * if i < mins[0]: * mins[0] = i * if i > maxs[0]: # <<<<<<<<<<<<<< * maxs[0] = i * if j < mins[1]: */ __pyx_t_36 = 0; __pyx_t_9 = -1; if (__pyx_t_36 < 0) { __pyx_t_36 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_36, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":89 * mins[0] = i * if i > maxs[0]: * maxs[0] = i # <<<<<<<<<<<<<< * if j < mins[1]: * mins[1] = i */ __pyx_t_37 = 0; __pyx_t_9 = -1; if (__pyx_t_37 < 0) { __pyx_t_37 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_37 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_37, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L27; } __pyx_L27:; /* "xutils.pyx":90 * if i > maxs[0]: * maxs[0] = i * if j < mins[1]: # <<<<<<<<<<<<<< * mins[1] = i * if j > maxs[1]: */ __pyx_t_38 = 1; __pyx_t_9 = -1; if (__pyx_t_38 < 0) { __pyx_t_38 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_38 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_38, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":91 * maxs[0] = i * if j < mins[1]: * mins[1] = i # <<<<<<<<<<<<<< * if j > maxs[1]: * maxs[1] = i */ __pyx_t_39 = 1; __pyx_t_9 = -1; if (__pyx_t_39 < 0) { __pyx_t_39 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_39 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_39, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L28; } __pyx_L28:; /* "xutils.pyx":92 * if j < mins[1]: * mins[1] = i * if j > maxs[1]: # <<<<<<<<<<<<<< * maxs[1] = i * if k < mins[2]: */ __pyx_t_40 = 1; __pyx_t_9 = -1; if (__pyx_t_40 < 0) { __pyx_t_40 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_40, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":93 * mins[1] = i * if j > maxs[1]: * maxs[1] = i # <<<<<<<<<<<<<< * if k < mins[2]: * mins[2] = i */ __pyx_t_41 = 1; __pyx_t_9 = -1; if (__pyx_t_41 < 0) { __pyx_t_41 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_41 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_41, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L29; } __pyx_L29:; /* "xutils.pyx":94 * if j > maxs[1]: * maxs[1] = i * if k < mins[2]: # <<<<<<<<<<<<<< * mins[2] = i * if k > maxs[2]: */ __pyx_t_42 = 2; __pyx_t_9 = -1; if (__pyx_t_42 < 0) { __pyx_t_42 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_42 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_k < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_42, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":95 * maxs[1] = i * if k < mins[2]: * mins[2] = i # <<<<<<<<<<<<<< * if k > maxs[2]: * maxs[2] = i */ __pyx_t_43 = 2; __pyx_t_9 = -1; if (__pyx_t_43 < 0) { __pyx_t_43 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_43 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_43 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_43, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L30; } __pyx_L30:; /* "xutils.pyx":96 * if k < mins[2]: * mins[2] = i * if k > maxs[2]: # <<<<<<<<<<<<<< * maxs[2] = i * elif ndims == 4: */ __pyx_t_44 = 2; __pyx_t_9 = -1; if (__pyx_t_44 < 0) { __pyx_t_44 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_44 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_44 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_k > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_44, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":97 * mins[2] = i * if k > maxs[2]: * maxs[2] = i # <<<<<<<<<<<<<< * elif ndims == 4: * # with nogil: */ __pyx_t_45 = 2; __pyx_t_9 = -1; if (__pyx_t_45 < 0) { __pyx_t_45 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_45 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_45 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_45, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L31; } __pyx_L31:; goto __pyx_L25; } __pyx_L25:; } } } break; /* "xutils.pyx":98 * if k > maxs[2]: * maxs[2] = i * elif ndims == 4: # <<<<<<<<<<<<<< * # with nogil: * for i in range(shape[0]): */ case 4: /* "xutils.pyx":100 * elif ndims == 4: * # with nogil: * for i in range(shape[0]): # <<<<<<<<<<<<<< * for j in range(shape[1]): * for k in range(shape[2]): */ __pyx_t_17 = 0; __pyx_t_9 = -1; if (__pyx_t_17 < 0) { __pyx_t_17 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_17, __pyx_bstride_0_shape)); for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_19; __pyx_t_29+=1) { __pyx_v_i = __pyx_t_29; /* "xutils.pyx":101 * # with nogil: * for i in range(shape[0]): * for j in range(shape[1]): # <<<<<<<<<<<<<< * for k in range(shape[2]): * for l in range(shape[3]): */ __pyx_t_30 = 1; __pyx_t_9 = -1; if (__pyx_t_30 < 0) { __pyx_t_30 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_32 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_30, __pyx_bstride_0_shape)); for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { __pyx_v_j = __pyx_t_33; /* "xutils.pyx":102 * for i in range(shape[0]): * for j in range(shape[1]): * for k in range(shape[2]): # <<<<<<<<<<<<<< * for l in range(shape[3]): * if data[i, j, k, l] > 0.0: */ __pyx_t_46 = 2; __pyx_t_9 = -1; if (__pyx_t_46 < 0) { __pyx_t_46 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_46 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_46 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_47 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_46, __pyx_bstride_0_shape)); for (__pyx_t_48 = 0; __pyx_t_48 < __pyx_t_47; __pyx_t_48+=1) { __pyx_v_k = __pyx_t_48; /* "xutils.pyx":103 * for j in range(shape[1]): * for k in range(shape[2]): * for l in range(shape[3]): # <<<<<<<<<<<<<< * if data[i, j, k, l] > 0.0: * if i < mins[0]: */ __pyx_t_49 = 3; __pyx_t_9 = -1; if (__pyx_t_49 < 0) { __pyx_t_49 += __pyx_bshape_0_shape; if (unlikely(__pyx_t_49 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_49 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_50 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_49, __pyx_bstride_0_shape)); for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) { __pyx_v_l = __pyx_t_51; /* "xutils.pyx":104 * for k in range(shape[2]): * for l in range(shape[3]): * if data[i, j, k, l] > 0.0: # <<<<<<<<<<<<<< * if i < mins[0]: * mins[0] = i */ __pyx_t_7 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_52 = PyTuple_New(4); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_52)); PyTuple_SET_ITEM(__pyx_t_52, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_52, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_52, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_52, 3, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_52)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_52)); __pyx_t_52 = 0; __pyx_t_52 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_52); __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_52, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_52); __pyx_t_52 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_12) { /* "xutils.pyx":105 * for l in range(shape[3]): * if data[i, j, k, l] > 0.0: * if i < mins[0]: # <<<<<<<<<<<<<< * mins[0] = i * if i > maxs[0]: */ __pyx_t_53 = 0; __pyx_t_9 = -1; if (__pyx_t_53 < 0) { __pyx_t_53 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_53 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_53 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_53, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":106 * if data[i, j, k, l] > 0.0: * if i < mins[0]: * mins[0] = i # <<<<<<<<<<<<<< * if i > maxs[0]: * maxs[0] = i */ __pyx_t_54 = 0; __pyx_t_9 = -1; if (__pyx_t_54 < 0) { __pyx_t_54 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_54 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_54, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L41; } __pyx_L41:; /* "xutils.pyx":107 * if i < mins[0]: * mins[0] = i * if i > maxs[0]: # <<<<<<<<<<<<<< * maxs[0] = i * if j < mins[1]: */ __pyx_t_55 = 0; __pyx_t_9 = -1; if (__pyx_t_55 < 0) { __pyx_t_55 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_55 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_55 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_55, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":108 * mins[0] = i * if i > maxs[0]: * maxs[0] = i # <<<<<<<<<<<<<< * if j < mins[1]: * mins[1] = i */ __pyx_t_56 = 0; __pyx_t_9 = -1; if (__pyx_t_56 < 0) { __pyx_t_56 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_56 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_56, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L42; } __pyx_L42:; /* "xutils.pyx":109 * if i > maxs[0]: * maxs[0] = i * if j < mins[1]: # <<<<<<<<<<<<<< * mins[1] = i * if j > maxs[1]: */ __pyx_t_57 = 1; __pyx_t_9 = -1; if (__pyx_t_57 < 0) { __pyx_t_57 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_57 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_57 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_57, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":110 * maxs[0] = i * if j < mins[1]: * mins[1] = i # <<<<<<<<<<<<<< * if j > maxs[1]: * maxs[1] = i */ __pyx_t_58 = 1; __pyx_t_9 = -1; if (__pyx_t_58 < 0) { __pyx_t_58 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_58 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_58, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L43; } __pyx_L43:; /* "xutils.pyx":111 * if j < mins[1]: * mins[1] = i * if j > maxs[1]: # <<<<<<<<<<<<<< * maxs[1] = i * if k < mins[2]: */ __pyx_t_59 = 1; __pyx_t_9 = -1; if (__pyx_t_59 < 0) { __pyx_t_59 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_59 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_59 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_59, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":112 * mins[1] = i * if j > maxs[1]: * maxs[1] = i # <<<<<<<<<<<<<< * if k < mins[2]: * mins[2] = i */ __pyx_t_60 = 1; __pyx_t_9 = -1; if (__pyx_t_60 < 0) { __pyx_t_60 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_60 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_60, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L44; } __pyx_L44:; /* "xutils.pyx":113 * if j > maxs[1]: * maxs[1] = i * if k < mins[2]: # <<<<<<<<<<<<<< * mins[2] = i * if k > maxs[2]: */ __pyx_t_61 = 2; __pyx_t_9 = -1; if (__pyx_t_61 < 0) { __pyx_t_61 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_61 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_61 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_k < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_61, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":114 * maxs[1] = i * if k < mins[2]: * mins[2] = i # <<<<<<<<<<<<<< * if k > maxs[2]: * maxs[2] = i */ __pyx_t_62 = 2; __pyx_t_9 = -1; if (__pyx_t_62 < 0) { __pyx_t_62 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_62 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_62, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L45; } __pyx_L45:; /* "xutils.pyx":115 * if k < mins[2]: * mins[2] = i * if k > maxs[2]: # <<<<<<<<<<<<<< * maxs[2] = i * if l < mins[3]: */ __pyx_t_63 = 2; __pyx_t_9 = -1; if (__pyx_t_63 < 0) { __pyx_t_63 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_63 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_63 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_k > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_63, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":116 * mins[2] = i * if k > maxs[2]: * maxs[2] = i # <<<<<<<<<<<<<< * if l < mins[3]: * mins[3] = i */ __pyx_t_64 = 2; __pyx_t_9 = -1; if (__pyx_t_64 < 0) { __pyx_t_64 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_64 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_64, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L46; } __pyx_L46:; /* "xutils.pyx":117 * if k > maxs[2]: * maxs[2] = i * if l < mins[3]: # <<<<<<<<<<<<<< * mins[3] = i * if l > maxs[3]: */ __pyx_t_65 = 3; __pyx_t_9 = -1; if (__pyx_t_65 < 0) { __pyx_t_65 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_65 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_65 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_l < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_65, __pyx_bstride_0_mins))); if (__pyx_t_12) { /* "xutils.pyx":118 * maxs[2] = i * if l < mins[3]: * mins[3] = i # <<<<<<<<<<<<<< * if l > maxs[3]: * maxs[3] = i */ __pyx_t_66 = 3; __pyx_t_9 = -1; if (__pyx_t_66 < 0) { __pyx_t_66 += __pyx_bshape_0_mins; if (unlikely(__pyx_t_66 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_66, __pyx_bstride_0_mins) = __pyx_v_i; goto __pyx_L47; } __pyx_L47:; /* "xutils.pyx":119 * if l < mins[3]: * mins[3] = i * if l > maxs[3]: # <<<<<<<<<<<<<< * maxs[3] = i * else: */ __pyx_t_67 = 3; __pyx_t_9 = -1; if (__pyx_t_67 < 0) { __pyx_t_67 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_67 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_67 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = (__pyx_v_l > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_67, __pyx_bstride_0_maxs))); if (__pyx_t_12) { /* "xutils.pyx":120 * mins[3] = i * if l > maxs[3]: * maxs[3] = i # <<<<<<<<<<<<<< * else: * raise RuntimeError("Dimensions > 4 not implemented") */ __pyx_t_68 = 3; __pyx_t_9 = -1; if (__pyx_t_68 < 0) { __pyx_t_68 += __pyx_bshape_0_maxs; if (unlikely(__pyx_t_68 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_68, __pyx_bstride_0_maxs) = __pyx_v_i; goto __pyx_L48; } __pyx_L48:; goto __pyx_L40; } __pyx_L40:; } } } } break; default: /* "xutils.pyx":122 * maxs[3] = i * else: * raise RuntimeError("Dimensions > 4 not implemented") # <<<<<<<<<<<<<< * return tuple(mins) + tuple(maxs) * */ __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } /* "xutils.pyx":123 * else: * raise RuntimeError("Dimensions > 4 not implemented") * return tuple(mins) + tuple(maxs) # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_mins)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mins)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mins)); __pyx_t_52 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_52); __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_maxs)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_maxs)); __Pyx_GIVEREF(((PyObject *)__pyx_v_maxs)); __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Add(__pyx_t_52, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_52); __pyx_t_52 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 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_7); __Pyx_XDECREF(__pyx_t_52); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxs); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shape); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mins); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("xutils.boundingBox", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxs); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shape); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mins); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_shape); __Pyx_XDECREF((PyObject *)__pyx_v_mins); __Pyx_XDECREF((PyObject *)__pyx_v_maxs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":190 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":196 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":199 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":200 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":202 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":204 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":205 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L6; } /*else*/ { /* "numpy.pxd":207 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L6:; /* "numpy.pxd":209 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":210 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":213 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":218 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":219 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":222 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":223 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":224 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":225 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); /* "numpy.pxd":226 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } goto __pyx_L9; } /*else*/ { /* "numpy.pxd":228 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":229 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } __pyx_L9:; /* "numpy.pxd":230 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":231 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":232 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":235 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":236 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; /* "numpy.pxd":240 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":242 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":244 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L12; } /*else*/ { /* "numpy.pxd":247 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L12:; /* "numpy.pxd":249 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":250 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; /* "numpy.pxd":251 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":252 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "numpy.pxd":254 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L15; } /* "numpy.pxd":255 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L15; } /* "numpy.pxd":256 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L15; } /* "numpy.pxd":257 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L15; } /* "numpy.pxd":258 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L15; } /* "numpy.pxd":259 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L15; } /* "numpy.pxd":260 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L15; } /* "numpy.pxd":261 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L15; } /* "numpy.pxd":262 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L15; } /* "numpy.pxd":263 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L15; } /* "numpy.pxd":264 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L15; } /* "numpy.pxd":265 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L15; } /* "numpy.pxd":266 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L15; } /* "numpy.pxd":267 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L15; } /* "numpy.pxd":268 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L15; } /* "numpy.pxd":269 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L15; } /* "numpy.pxd":270 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L15; } /*else*/ { /* "numpy.pxd":272 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L15:; /* "numpy.pxd":273 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":274 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = '^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":277 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":278 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":281 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":282 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = 0; } __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":284 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); /* "numpy.pxd":285 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { /* "numpy.pxd":286 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":287 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":288 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L6; } __pyx_L6:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":764 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); /* "numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":767 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":770 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":773 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":776 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":779 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); /* "numpy.pxd":786 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":787 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":790 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":791 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":792 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":794 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":797 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; } else { __pyx_t_7 = __pyx_t_6; } if (!__pyx_t_7) { /* "numpy.pxd":798 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { __pyx_t_8 = (!__pyx_v_little_endian); __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":809 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; /* "numpy.pxd":810 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":811 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":812 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } /* "numpy.pxd":814 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); /* "numpy.pxd":816 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { /* "numpy.pxd":817 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":818 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "numpy.pxd":822 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } /* "numpy.pxd":823 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } /* "numpy.pxd":824 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } /* "numpy.pxd":825 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } /* "numpy.pxd":826 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } /* "numpy.pxd":827 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } /* "numpy.pxd":828 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } /* "numpy.pxd":829 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } /* "numpy.pxd":830 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } /* "numpy.pxd":831 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } /* "numpy.pxd":832 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } /* "numpy.pxd":833 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } /* "numpy.pxd":834 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } /* "numpy.pxd":835 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":836 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":837 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":838 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":840 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; /* "numpy.pxd":841 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { /* "numpy.pxd":845 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_11; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":846 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":961 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); /* "numpy.pxd":963 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":964 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":966 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":967 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":968 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":969 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); /* "numpy.pxd":972 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":973 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":975 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("xutils"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, {&__pyx_n_s__boundingBox, __pyx_k__boundingBox, sizeof(__pyx_k__boundingBox), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1}, {&__pyx_n_s__maxs, __pyx_k__maxs, sizeof(__pyx_k__maxs), 0, 0, 1, 1}, {&__pyx_n_s__mins, __pyx_k__mins, sizeof(__pyx_k__mins), 0, 0, 1, 1}, {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__ndims, __pyx_k__ndims, sizeof(__pyx_k__ndims), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__xutils, __pyx_k__xutils, sizeof(__pyx_k__xutils), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "xutils.pyx":122 * maxs[3] = i * else: * raise RuntimeError("Dimensions > 4 not implemented") # <<<<<<<<<<<<<< * return tuple(mins) + tuple(maxs) * */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "xutils.pyx":34 * ctypedef numpy.float64_t DTYPE_float64_t * * def boundingBox(data): # <<<<<<<<<<<<<< * """ * Calculate bounding box around */ __pyx_k_tuple_15 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__shape)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__shape)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ndims)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__ndims)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndims)); __Pyx_INCREF(((PyObject *)__pyx_n_s__mins)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__mins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__maxs)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__maxs)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxs)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((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_15, 6, ((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_15, 7, ((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_15, 8, ((PyObject *)__pyx_n_s__l)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__boundingBox, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initxutils(void); /*proto*/ PyMODINIT_FUNC initxutils(void) #else PyMODINIT_FUNC PyInit_xutils(void); /*proto*/ PyMODINIT_FUNC PyInit_xutils(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_xutils(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("xutils"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_xutils) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "xutils.pyx":29 * import cython * cimport numpy * import numpy # <<<<<<<<<<<<<< * * ctypedef numpy.int64_t DTYPE_int64_t */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "xutils.pyx":34 * ctypedef numpy.float64_t DTYPE_float64_t * * def boundingBox(data): # <<<<<<<<<<<<<< * """ * Calculate bounding box around */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6xutils_boundingBox, NULL, __pyx_n_s__xutils); 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); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__boundingBox, __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; /* "xutils.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # -*- coding: utf8 -*- * # */ __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; /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init xutils", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init xutils"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; int is_complex; char enc_type; char new_packmode; char enc_packmode; } __Pyx_BufFmt_Context; static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'b': return "'char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset; if (ctx->enc_type == 0) return 0; group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } __Pyx_BufFmt_RaiseExpected(ctx); return -1; } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; --ctx->enc_count; /* Consume from buffer string */ /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; } break; case '}': /* end of substruct; either repeat or move on */ ++ts; return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; default: { int number = __Pyx_BufFmt_ParseNumber(&ts); if (number == -1) { /* First char was not a digit */ PyErr_Format(PyExc_ValueError, "Does not understand character buffer dtype format string ('%c')", *ts); return NULL; } ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); else { PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject* obj = view->obj; if (obj) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); Py_DECREF(obj); view->obj = NULL; } } #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pyfai-0.3.5/src/splitPixel.c0000644001611600065110000157567611656053755015141 0ustar kieffersoft/* Generated by Cython 0.15.1+ on Mon Nov 7 23:13:01 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif /* new Py3.3 unicode representation (PEP 393) */ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) #define CYTHON_PEP393_ENABLED #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #else #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__splitPixel #define __PYX_HAVE_API__splitPixel #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "splitPixel.pyx", "numpy.pxd", }; /* "numpy.pxd":719 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":720 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":721 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":722 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":726 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":727 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":728 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":729 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":733 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":734 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":743 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":744 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":745 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":747 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":748 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":749 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":751 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":752 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":754 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":755 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":756 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "splitPixel.pyx":42 * void * malloc(size_t size)nogil * * ctypedef numpy.int64_t DTYPE_int64_t # <<<<<<<<<<<<<< * ctypedef numpy.float64_t DTYPE_float64_t * */ typedef __pyx_t_5numpy_int64_t __pyx_t_10splitPixel_DTYPE_int64_t; /* "splitPixel.pyx":43 * * ctypedef numpy.int64_t DTYPE_int64_t * ctypedef numpy.float64_t DTYPE_float64_t # <<<<<<<<<<<<<< * * cdef double areaTriangle(double a0, */ typedef __pyx_t_5numpy_float64_t __pyx_t_10splitPixel_DTYPE_float64_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":758 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":759 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":760 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":762 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ /* Run-time type information about structs used with buffers */ struct __Pyx_StructField_; typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif Py_ssize_t __Pyx_zeros[] = {0, 0, 0}; Py_ssize_t __Pyx_minusones[] = {-1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ #if PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'splitPixel' */ static double __pyx_f_10splitPixel_areaTriangle(double, double, double, double, double, double); /*proto*/ static double __pyx_f_10splitPixel_areaQuad(double, double, double, double, double, double, double, double); /*proto*/ static double __pyx_f_10splitPixel_getBinNr(double, double, double); /*proto*/ static double __pyx_f_10splitPixel_min4f(double, double, double, double); /*proto*/ static double __pyx_f_10splitPixel_max4f(double, double, double, double); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t = { "DTYPE_float64_t", NULL, sizeof(__pyx_t_10splitPixel_DTYPE_float64_t), 'R' }; #define __Pyx_MODULE_NAME "splitPixel" int __pyx_module_is_main_splitPixel = 0; /* Implementation of 'splitPixel' */ static PyObject *__pyx_builtin_min; static PyObject *__pyx_builtin_max; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_29[] = "max0 (%s) < self.pos0_min %s"; static char __pyx_k_30[] = "max1 (%s) < pos1_min %s"; static char __pyx_k_31[] = "min0 (%s) > pos0_maxin %s"; static char __pyx_k_32[] = "min1 (%s) > pos1_maxin %s"; static char __pyx_k_33[] = "ndarray is not C contiguous"; static char __pyx_k_35[] = "ndarray is not Fortran contiguous"; static char __pyx_k_37[] = "Non-native byte order not supported"; static char __pyx_k_39[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_40[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_43[] = "Format string allocated too short."; static char __pyx_k_47[] = "/home/jerome/workspace/azimuthal/pyFAI/src/splitPixel.pyx"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__T[] = "T"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__a0[] = "a0"; static char __pyx_k__a1[] = "a1"; static char __pyx_k__b0[] = "b0"; static char __pyx_k__b1[] = "b1"; static char __pyx_k__c0[] = "c0"; static char __pyx_k__c1[] = "c1"; static char __pyx_k__d0[] = "d0"; static char __pyx_k__d1[] = "d1"; static char __pyx_k__bin[] = "bin"; static char __pyx_k__eps[] = "eps"; static char __pyx_k__idx[] = "idx"; static char __pyx_k__max[] = "max"; static char __pyx_k__min[] = "min"; static char __pyx_k__pos[] = "pos"; static char __pyx_k__bins[] = "bins"; static char __pyx_k__cpos[] = "cpos"; static char __pyx_k__data[] = "data"; static char __pyx_k__dpos[] = "dpos"; static char __pyx_k__max0[] = "max0"; static char __pyx_k__max1[] = "max1"; static char __pyx_k__min0[] = "min0"; static char __pyx_k__min1[] = "min1"; static char __pyx_k__size[] = "size"; static char __pyx_k__bins0[] = "bins0"; static char __pyx_k__bins1[] = "bins1"; static char __pyx_k__cdata[] = "cdata"; static char __pyx_k__dpos0[] = "dpos0"; static char __pyx_k__dpos1[] = "dpos1"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__dummy[] = "dummy"; static char __pyx_k__finfo[] = "finfo"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__ravel[] = "ravel"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__astype[] = "astype"; static char __pyx_k__deltaA[] = "deltaA"; static char __pyx_k__deltaD[] = "deltaD"; static char __pyx_k__deltaL[] = "deltaL"; static char __pyx_k__deltaR[] = "deltaR"; static char __pyx_k__deltaU[] = "deltaU"; static char __pyx_k__double[] = "double"; static char __pyx_k__edges0[] = "edges0"; static char __pyx_k__edges1[] = "edges1"; static char __pyx_k__outPos[] = "outPos"; static char __pyx_k__epsilon[] = "epsilon"; static char __pyx_k__float64[] = "float64"; static char __pyx_k__outData[] = "outData"; static char __pyx_k__weights[] = "weights"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__bin0_max[] = "bin0_max"; static char __pyx_k__bin0_min[] = "bin0_min"; static char __pyx_k__bin1_max[] = "bin1_max"; static char __pyx_k__bin1_min[] = "bin1_min"; static char __pyx_k__outCount[] = "outCount"; static char __pyx_k__outMerge[] = "outMerge"; static char __pyx_k__pos0_max[] = "pos0_max"; static char __pyx_k__pos0_min[] = "pos0_min"; static char __pyx_k__pos1_max[] = "pos1_max"; static char __pyx_k__pos1_min[] = "pos1_min"; static char __pyx_k__aeraPixel[] = "aeraPixel"; static char __pyx_k__fbin0_max[] = "fbin0_max"; static char __pyx_k__fbin0_min[] = "fbin0_min"; static char __pyx_k__fbin1_max[] = "fbin1_max"; static char __pyx_k__fbin1_min[] = "fbin1_min"; static char __pyx_k__pos0Range[] = "pos0Range"; static char __pyx_k__pos1Range[] = "pos1Range"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__pos0_maxin[] = "pos0_maxin"; static char __pyx_k__pos1_maxin[] = "pos1_maxin"; static char __pyx_k__splitPixel[] = "splitPixel"; static char __pyx_k__fullSplit1D[] = "fullSplit1D"; static char __pyx_k__fullSplit2D[] = "fullSplit2D"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_29; static PyObject *__pyx_kp_s_30; static PyObject *__pyx_kp_s_31; static PyObject *__pyx_kp_s_32; static PyObject *__pyx_kp_u_33; static PyObject *__pyx_kp_u_35; static PyObject *__pyx_kp_u_37; static PyObject *__pyx_kp_u_39; static PyObject *__pyx_kp_u_40; static PyObject *__pyx_kp_u_43; static PyObject *__pyx_kp_s_47; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__a0; static PyObject *__pyx_n_s__a1; static PyObject *__pyx_n_s__aeraPixel; static PyObject *__pyx_n_s__astype; static PyObject *__pyx_n_s__b0; static PyObject *__pyx_n_s__b1; static PyObject *__pyx_n_s__bin; static PyObject *__pyx_n_s__bin0_max; static PyObject *__pyx_n_s__bin0_min; static PyObject *__pyx_n_s__bin1_max; static PyObject *__pyx_n_s__bin1_min; static PyObject *__pyx_n_s__bins; static PyObject *__pyx_n_s__bins0; static PyObject *__pyx_n_s__bins1; static PyObject *__pyx_n_s__c0; static PyObject *__pyx_n_s__c1; static PyObject *__pyx_n_s__cdata; static PyObject *__pyx_n_s__cpos; static PyObject *__pyx_n_s__d0; static PyObject *__pyx_n_s__d1; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__deltaA; static PyObject *__pyx_n_s__deltaD; static PyObject *__pyx_n_s__deltaL; static PyObject *__pyx_n_s__deltaR; static PyObject *__pyx_n_s__deltaU; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dpos; static PyObject *__pyx_n_s__dpos0; static PyObject *__pyx_n_s__dpos1; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__dummy; static PyObject *__pyx_n_s__edges0; static PyObject *__pyx_n_s__edges1; static PyObject *__pyx_n_s__eps; static PyObject *__pyx_n_s__epsilon; static PyObject *__pyx_n_s__fbin0_max; static PyObject *__pyx_n_s__fbin0_min; static PyObject *__pyx_n_s__fbin1_max; static PyObject *__pyx_n_s__fbin1_min; static PyObject *__pyx_n_s__finfo; static PyObject *__pyx_n_s__float64; static PyObject *__pyx_n_s__fullSplit1D; static PyObject *__pyx_n_s__fullSplit2D; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__idx; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__max; static PyObject *__pyx_n_s__max0; static PyObject *__pyx_n_s__max1; static PyObject *__pyx_n_s__min; static PyObject *__pyx_n_s__min0; static PyObject *__pyx_n_s__min1; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__outCount; static PyObject *__pyx_n_s__outData; static PyObject *__pyx_n_s__outMerge; static PyObject *__pyx_n_s__outPos; static PyObject *__pyx_n_s__pos; static PyObject *__pyx_n_s__pos0Range; static PyObject *__pyx_n_s__pos0_max; static PyObject *__pyx_n_s__pos0_maxin; static PyObject *__pyx_n_s__pos0_min; static PyObject *__pyx_n_s__pos1Range; static PyObject *__pyx_n_s__pos1_max; static PyObject *__pyx_n_s__pos1_maxin; static PyObject *__pyx_n_s__pos1_min; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__ravel; static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__splitPixel; static PyObject *__pyx_n_s__weights; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; static PyObject *__pyx_k_slice_3; static PyObject *__pyx_k_slice_4; static PyObject *__pyx_k_slice_6; static PyObject *__pyx_k_slice_7; static PyObject *__pyx_k_slice_9; static PyObject *__pyx_k_tuple_1; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_slice_10; static PyObject *__pyx_k_slice_12; static PyObject *__pyx_k_slice_13; static PyObject *__pyx_k_slice_17; static PyObject *__pyx_k_slice_18; static PyObject *__pyx_k_slice_20; static PyObject *__pyx_k_slice_21; static PyObject *__pyx_k_slice_23; static PyObject *__pyx_k_slice_24; static PyObject *__pyx_k_slice_26; static PyObject *__pyx_k_slice_27; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_19; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_tuple_28; static PyObject *__pyx_k_tuple_34; static PyObject *__pyx_k_tuple_36; static PyObject *__pyx_k_tuple_38; static PyObject *__pyx_k_tuple_41; static PyObject *__pyx_k_tuple_42; static PyObject *__pyx_k_tuple_44; static PyObject *__pyx_k_tuple_45; static PyObject *__pyx_k_tuple_48; static PyObject *__pyx_k_codeobj_46; static PyObject *__pyx_k_codeobj_49; /* "splitPixel.pyx":45 * ctypedef numpy.float64_t DTYPE_float64_t * * cdef double areaTriangle(double a0, # <<<<<<<<<<<<<< * double a1, * double b0, */ static double __pyx_f_10splitPixel_areaTriangle(double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_b0, double __pyx_v_b1, double __pyx_v_c0, double __pyx_v_c1) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("areaTriangle"); /* "splitPixel.pyx":58 * @return: area, i.e. 1/2 * (B-A)^(C-A) * """ * return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0))) # <<<<<<<<<<<<<< * * cdef double areaQuad(double a0, */ __pyx_r = (0.5 * fabs((((__pyx_v_b0 - __pyx_v_a0) * (__pyx_v_c1 - __pyx_v_a1)) - ((__pyx_v_b1 - __pyx_v_a1) * (__pyx_v_c0 - __pyx_v_a0))))); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "splitPixel.pyx":60 * return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0))) * * cdef double areaQuad(double a0, # <<<<<<<<<<<<<< * double a1, * double b0, */ static double __pyx_f_10splitPixel_areaQuad(double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_b0, double __pyx_v_b1, double __pyx_v_c0, double __pyx_v_c1, double __pyx_v_d0, double __pyx_v_d1) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("areaQuad"); /* "splitPixel.pyx":77 * @return: area, i.e. 1/2 * (AC ^ BD) * """ * return 0.5 * abs(((c0 - a0) * (d1 - b1)) - ((c1 - a1) * (d0 - b0))) # <<<<<<<<<<<<<< * * @cython.cdivision(True) */ __pyx_r = (0.5 * fabs((((__pyx_v_c0 - __pyx_v_a0) * (__pyx_v_d1 - __pyx_v_b1)) - ((__pyx_v_c1 - __pyx_v_a1) * (__pyx_v_d0 - __pyx_v_b0))))); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "splitPixel.pyx":80 * * @cython.cdivision(True) * cdef double getBinNr(double x0, double pos0_min, double dpos) nogil: # <<<<<<<<<<<<<< * """ * calculate the bin number for any point */ static double __pyx_f_10splitPixel_getBinNr(double __pyx_v_x0, double __pyx_v_pos0_min, double __pyx_v_dpos) { double __pyx_r; /* "splitPixel.pyx":87 * param dpos: bin width * """ * return (x0 - pos0_min) / dpos # <<<<<<<<<<<<<< * * cdef double min4f(double a, double b, double c, double d) nogil: */ __pyx_r = ((__pyx_v_x0 - __pyx_v_pos0_min) / __pyx_v_dpos); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "splitPixel.pyx":89 * return (x0 - pos0_min) / dpos * * cdef double min4f(double a, double b, double c, double d) nogil: # <<<<<<<<<<<<<< * if (a <= b) and (a <= c) and (a <= d): * return a */ static double __pyx_f_10splitPixel_min4f(double __pyx_v_a, double __pyx_v_b, double __pyx_v_c, double __pyx_v_d) { double __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "splitPixel.pyx":90 * * cdef double min4f(double a, double b, double c, double d) nogil: * 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) { /* "splitPixel.pyx":91 * cdef double min4f(double a, double b, double c, double d) nogil: * 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:; /* "splitPixel.pyx":92 * 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) { /* "splitPixel.pyx":93 * 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:; /* "splitPixel.pyx":94 * 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) { /* "splitPixel.pyx":95 * 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*/ { /* "splitPixel.pyx":97 * return c * else: * return d # <<<<<<<<<<<<<< * * cdef double max4f(double a, double b, double c, double d) nogil: */ __pyx_r = __pyx_v_d; goto __pyx_L0; } __pyx_L5:; __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "splitPixel.pyx":99 * return d * * cdef double max4f(double a, double b, double c, double d) nogil: # <<<<<<<<<<<<<< * """Calculates the max of 4 double numbers""" * if (a >= b) and (a >= c) and (a >= d): */ static double __pyx_f_10splitPixel_max4f(double __pyx_v_a, double __pyx_v_b, double __pyx_v_c, double __pyx_v_d) { double __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "splitPixel.pyx":101 * cdef double max4f(double a, double b, double c, double d) nogil: * """Calculates the max of 4 double 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) { /* "splitPixel.pyx":102 * """Calculates the max of 4 double 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:; /* "splitPixel.pyx":103 * 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) { /* "splitPixel.pyx":104 * 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:; /* "splitPixel.pyx":105 * 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) { /* "splitPixel.pyx":106 * 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*/ { /* "splitPixel.pyx":108 * return c * else: * return d # <<<<<<<<<<<<<< * * @cython.cdivision(True) */ __pyx_r = __pyx_v_d; goto __pyx_L0; } __pyx_L5:; __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "splitPixel.pyx":113 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit1D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * long bins=100, */ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_10splitPixel_fullSplit1D[] = "\n Calculates histogram of pos weighted by weights\n \n Splitting is done on the pixel's bounding box like fit2D\n \n \n @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi\n @param weights: array with intensities\n @param bins: number of output bins\n @param pos0Range: minimum and maximum of the 2th range\n @param pos1Range: minimum and maximum of the chi range\n @param dummy: value for bins without pixels \n @return 2theta, I, weighted histogram, unweighted histogram\n "; static PyMethodDef __pyx_mdef_10splitPixel_fullSplit1D = {__Pyx_NAMESTR("fullSplit1D"), (PyCFunction)__pyx_pf_10splitPixel_fullSplit1D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10splitPixel_fullSplit1D)}; static PyObject *__pyx_pf_10splitPixel_fullSplit1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_pos = 0; PyArrayObject *__pyx_v_weights = 0; long __pyx_v_bins; PyObject *__pyx_v_pos0Range = 0; PyObject *__pyx_v_pos1Range = 0; double __pyx_v_dummy; long __pyx_v_size; PyArrayObject *__pyx_v_cpos = 0; PyArrayObject *__pyx_v_cdata = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_outPos = 0; double __pyx_v_min0; double __pyx_v_max0; double __pyx_v_deltaR; double __pyx_v_deltaL; double __pyx_v_deltaA; double __pyx_v_pos0_min; double __pyx_v_pos0_max; double __pyx_v_pos0_maxin; CYTHON_UNUSED double __pyx_v_pos1_min; CYTHON_UNUSED double __pyx_v_pos1_max; double __pyx_v_pos1_maxin; double __pyx_v_dpos; CYTHON_UNUSED long __pyx_v_bin; long __pyx_v_i; long __pyx_v_idx; double __pyx_v_fbin0_min; double __pyx_v_fbin0_max; long __pyx_v_bin0_max; long __pyx_v_bin0_min; double __pyx_v_aeraPixel; double __pyx_v_a0; double __pyx_v_b0; double __pyx_v_c0; double __pyx_v_d0; double __pyx_v_epsilon; double __pyx_v_data; Py_buffer __pyx_bstruct_outPos; Py_ssize_t __pyx_bstride_0_outPos = 0; Py_ssize_t __pyx_bshape_0_outPos = 0; Py_buffer __pyx_bstruct_outMerge; Py_ssize_t __pyx_bstride_0_outMerge = 0; Py_ssize_t __pyx_bshape_0_outMerge = 0; Py_buffer __pyx_bstruct_outCount; Py_ssize_t __pyx_bstride_0_outCount = 0; Py_ssize_t __pyx_bshape_0_outCount = 0; Py_buffer __pyx_bstruct_cdata; Py_ssize_t __pyx_bstride_0_cdata = 0; Py_ssize_t __pyx_bshape_0_cdata = 0; Py_buffer __pyx_bstruct_cpos; Py_ssize_t __pyx_bstride_0_cpos = 0; Py_ssize_t __pyx_bstride_1_cpos = 0; Py_ssize_t __pyx_bstride_2_cpos = 0; Py_ssize_t __pyx_bshape_0_cpos = 0; Py_ssize_t __pyx_bshape_1_cpos = 0; Py_ssize_t __pyx_bshape_2_cpos = 0; Py_buffer __pyx_bstruct_outData; Py_ssize_t __pyx_bstride_0_outData = 0; Py_ssize_t __pyx_bshape_0_outData = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; long __pyx_t_5; PyArrayObject *__pyx_t_6 = NULL; PyArrayObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; PyArrayObject *__pyx_t_12 = NULL; Py_ssize_t __pyx_t_13; int __pyx_t_14; int __pyx_t_15; double __pyx_t_16; long __pyx_t_17; long __pyx_t_18; long __pyx_t_19; long __pyx_t_20; long __pyx_t_21; long __pyx_t_22; long __pyx_t_23; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; long __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; long __pyx_t_37; long __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; long __pyx_t_44; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("fullSplit1D"); __pyx_self = __pyx_self; { PyObject* values[6] = {0,0,0,0,0,0}; /* "splitPixel.pyx":116 * numpy.ndarray weights not None, * long bins=100, * pos0Range=None, # <<<<<<<<<<<<<< * pos1Range=None, * double dummy=0.0 */ values[3] = ((PyObject *)Py_None); /* "splitPixel.pyx":117 * long bins=100, * pos0Range=None, * pos1Range=None, # <<<<<<<<<<<<<< * double dummy=0.0 * ): */ values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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 (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("fullSplit1D", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[5] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fullSplit1D") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { 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); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pos = ((PyArrayObject *)values[0]); __pyx_v_weights = ((PyArrayObject *)values[1]); if (values[2]) { __pyx_v_bins = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_bins = ((long)100); } __pyx_v_pos0Range = values[3]; __pyx_v_pos1Range = values[4]; if (values[5]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "splitPixel.pyx":118 * pos0Range=None, * pos1Range=None, * double dummy=0.0 # <<<<<<<<<<<<<< * ): * """ */ __pyx_v_dummy = ((double)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("fullSplit1D", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("splitPixel.fullSplit1D", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_cpos.buf = NULL; __pyx_bstruct_cdata.buf = NULL; __pyx_bstruct_outData.buf = NULL; __pyx_bstruct_outCount.buf = NULL; __pyx_bstruct_outMerge.buf = NULL; __pyx_bstruct_outPos.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "splitPixel.pyx":135 * """ * * assert pos.shape[0] == weights.size # <<<<<<<<<<<<<< * assert pos.shape[1] == 4 * assert pos.shape[2] == 2 */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":136 * * assert pos.shape[0] == weights.size * assert pos.shape[1] == 4 # <<<<<<<<<<<<<< * assert pos.shape[2] == 2 * assert pos.ndim == 3 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":137 * assert pos.shape[0] == weights.size * assert pos.shape[1] == 4 * assert pos.shape[2] == 2 # <<<<<<<<<<<<<< * assert pos.ndim == 3 * assert bins > 1 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":138 * assert pos.shape[1] == 4 * assert pos.shape[2] == 2 * assert pos.ndim == 3 # <<<<<<<<<<<<<< * assert bins > 1 * cdef long size = weights.size */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_pos->nd == 3))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":139 * assert pos.shape[2] == 2 * assert pos.ndim == 3 * assert bins > 1 # <<<<<<<<<<<<<< * cdef long size = weights.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_bins > 1))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":140 * assert pos.ndim == 3 * assert bins > 1 * cdef long size = weights.size # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_size = __pyx_t_5; /* "splitPixel.pyx":141 * assert bins > 1 * cdef long size = weights.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0]; __pyx_bstride_1_cpos = __pyx_bstruct_cpos.strides[1]; __pyx_bstride_2_cpos = __pyx_bstruct_cpos.strides[2]; __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0]; __pyx_bshape_1_cpos = __pyx_bstruct_cpos.shape[1]; __pyx_bshape_2_cpos = __pyx_bstruct_cpos.shape[2]; } } __pyx_t_6 = 0; __pyx_v_cpos = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "splitPixel.pyx":142 * cdef long size = weights.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") */ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0]; __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0]; } } __pyx_t_7 = 0; __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitPixel.pyx":143 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; } } __pyx_t_9 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "splitPixel.pyx":144 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; } } __pyx_t_10 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "splitPixel.pyx":145 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") * cdef double min0, max0, deltaR, deltaL, deltaA */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; } } __pyx_t_11 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "splitPixel.pyx":146 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64") # <<<<<<<<<<<<<< * cdef double min0, max0, deltaR, deltaL, deltaA * cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outPos, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outPos.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outPos = __pyx_bstruct_outPos.strides[0]; __pyx_bshape_0_outPos = __pyx_bstruct_outPos.shape[0]; } } __pyx_t_12 = 0; __pyx_v_outPos = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "splitPixel.pyx":149 * cdef double min0, max0, deltaR, deltaL, deltaA * cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin * if pos0Range is not None and len(pos0Range) > 1: # <<<<<<<<<<<<<< * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) */ __pyx_t_4 = (__pyx_v_pos0Range != Py_None); if (__pyx_t_4) { __pyx_t_13 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = (__pyx_t_13 > 1); __pyx_t_15 = __pyx_t_14; } else { __pyx_t_15 = __pyx_t_4; } if (__pyx_t_15) { /* "splitPixel.pyx":150 * cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin * if pos0Range is not None and len(pos0Range) > 1: * pos0_min = min(pos0Range) # <<<<<<<<<<<<<< * pos0_maxin = max(pos0Range) * else: */ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos0_min = __pyx_t_16; /* "splitPixel.pyx":151 * if pos0Range is not None and len(pos0Range) > 1: * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) # <<<<<<<<<<<<<< * else: * pos0_min = pos[:, :, 0].min() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_pos0_maxin = __pyx_t_16; goto __pyx_L6; } /*else*/ { /* "splitPixel.pyx":153 * pos0_maxin = max(pos0Range) * else: * pos0_min = pos[:, :, 0].min() # <<<<<<<<<<<<<< * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_5)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_pos0_min = __pyx_t_16; /* "splitPixel.pyx":154 * else: * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * if pos1Range is not None and len(pos1Range) > 1: */ __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_8)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_pos0_maxin = __pyx_t_16; } __pyx_L6:; /* "splitPixel.pyx":155 * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) */ __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__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 = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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_2, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos0_max = __pyx_t_16; /* "splitPixel.pyx":156 * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * if pos1Range is not None and len(pos1Range) > 1: # <<<<<<<<<<<<<< * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) */ __pyx_t_15 = (__pyx_v_pos1Range != Py_None); if (__pyx_t_15) { __pyx_t_13 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_13 > 1); __pyx_t_14 = __pyx_t_4; } else { __pyx_t_14 = __pyx_t_15; } if (__pyx_t_14) { /* "splitPixel.pyx":157 * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) # <<<<<<<<<<<<<< * pos1_maxin = max(pos1Range) * else: */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pos1_min = __pyx_t_16; /* "splitPixel.pyx":158 * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) # <<<<<<<<<<<<<< * else: * pos1_min = pos[:, :, 1].min() */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos1_maxin = __pyx_t_16; goto __pyx_L7; } /*else*/ { /* "splitPixel.pyx":160 * pos1_maxin = max(pos1Range) * else: * pos1_min = pos[:, :, 1].min() # <<<<<<<<<<<<<< * pos1_max = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_11)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos1_min = __pyx_t_16; /* "splitPixel.pyx":161 * else: * pos1_min = pos[:, :, 1].min() * pos1_max = pos[:, :, 1].max() # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) */ __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_14)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pos1_max = __pyx_t_16; } __pyx_L7:; /* "splitPixel.pyx":162 * pos1_min = pos[:, :, 1].min() * pos1_max = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) * cdef long bin = 0 */ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pos1_max = __pyx_t_16; /* "splitPixel.pyx":163 * pos1_max = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) # <<<<<<<<<<<<<< * cdef long bin = 0 * cdef long i, idx */ __pyx_v_dpos = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((double)__pyx_v_bins)); /* "splitPixel.pyx":164 * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) * cdef long bin = 0 # <<<<<<<<<<<<<< * cdef long i, idx * cdef double fbin0_min, fbin0_max#, fbin1_min, fbin1_max */ __pyx_v_bin = 0; /* "splitPixel.pyx":169 * cdef long bin0_max, bin0_min * cdef double aeraPixel, a0, b0, c0, d0 * cdef double epsilon = 1e-10 # <<<<<<<<<<<<<< * * with nogil: */ __pyx_v_epsilon = 1e-10; /* "splitPixel.pyx":171 * cdef double epsilon = 1e-10 * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< double > i) * dpos */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "splitPixel.pyx":172 * * with nogil: * for i in range(bins): # <<<<<<<<<<<<<< * outPos[i] = pos0_min + (0.5 +< double > i) * dpos * */ __pyx_t_5 = __pyx_v_bins; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; /* "splitPixel.pyx":173 * with nogil: * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< double > i) * dpos # <<<<<<<<<<<<<< * * for idx in range(size): */ __pyx_t_18 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outPos.buf, __pyx_t_18, __pyx_bstride_0_outPos) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos)); } /* "splitPixel.pyx":175 * outPos[i] = pos0_min + (0.5 +< double > i) * dpos * * for idx in range(size): # <<<<<<<<<<<<<< * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] */ __pyx_t_5 = __pyx_v_size; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) { __pyx_v_idx = __pyx_t_17; /* "splitPixel.pyx":176 * * for idx in range(size): * data = < double > cdata[idx] # <<<<<<<<<<<<<< * a0 = < double > cpos[idx, 0, 0] * b0 = < double > cpos[idx, 1, 0] */ __pyx_t_19 = __pyx_v_idx; __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_19, __pyx_bstride_0_cdata))); /* "splitPixel.pyx":177 * for idx in range(size): * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] # <<<<<<<<<<<<<< * b0 = < double > cpos[idx, 1, 0] * c0 = < double > cpos[idx, 2, 0] */ __pyx_t_20 = __pyx_v_idx; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_v_a0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_20, __pyx_bstride_0_cpos, __pyx_t_21, __pyx_bstride_1_cpos, __pyx_t_22, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":178 * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] * b0 = < double > cpos[idx, 1, 0] # <<<<<<<<<<<<<< * c0 = < double > cpos[idx, 2, 0] * d0 = < double > cpos[idx, 3, 0] */ __pyx_t_23 = __pyx_v_idx; __pyx_t_24 = 1; __pyx_t_25 = 0; __pyx_v_b0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_23, __pyx_bstride_0_cpos, __pyx_t_24, __pyx_bstride_1_cpos, __pyx_t_25, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":179 * a0 = < double > cpos[idx, 0, 0] * b0 = < double > cpos[idx, 1, 0] * c0 = < double > cpos[idx, 2, 0] # <<<<<<<<<<<<<< * d0 = < double > cpos[idx, 3, 0] * min0 = min4f(a0, b0, c0, d0) */ __pyx_t_26 = __pyx_v_idx; __pyx_t_27 = 2; __pyx_t_28 = 0; __pyx_v_c0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_26, __pyx_bstride_0_cpos, __pyx_t_27, __pyx_bstride_1_cpos, __pyx_t_28, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":180 * b0 = < double > cpos[idx, 1, 0] * c0 = < double > cpos[idx, 2, 0] * d0 = < double > cpos[idx, 3, 0] # <<<<<<<<<<<<<< * min0 = min4f(a0, b0, c0, d0) * max0 = max4f(a0, b0, c0, d0) */ __pyx_t_29 = __pyx_v_idx; __pyx_t_30 = 3; __pyx_t_31 = 0; __pyx_v_d0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_29, __pyx_bstride_0_cpos, __pyx_t_30, __pyx_bstride_1_cpos, __pyx_t_31, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":181 * c0 = < double > cpos[idx, 2, 0] * d0 = < double > cpos[idx, 3, 0] * min0 = min4f(a0, b0, c0, d0) # <<<<<<<<<<<<<< * max0 = max4f(a0, b0, c0, d0) * */ __pyx_v_min0 = __pyx_f_10splitPixel_min4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0); /* "splitPixel.pyx":182 * d0 = < double > cpos[idx, 3, 0] * min0 = min4f(a0, b0, c0, d0) * max0 = max4f(a0, b0, c0, d0) # <<<<<<<<<<<<<< * * fbin0_min = getBinNr(min0, pos0_min, dpos) */ __pyx_v_max0 = __pyx_f_10splitPixel_max4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0); /* "splitPixel.pyx":184 * max0 = max4f(a0, b0, c0, d0) * * fbin0_min = getBinNr(min0, pos0_min, dpos) # <<<<<<<<<<<<<< * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) */ __pyx_v_fbin0_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos); /* "splitPixel.pyx":185 * * fbin0_min = getBinNr(min0, pos0_min, dpos) * fbin0_max = getBinNr(max0, pos0_min, dpos) # <<<<<<<<<<<<<< * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) */ __pyx_v_fbin0_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos); /* "splitPixel.pyx":186 * fbin0_min = getBinNr(min0, pos0_min, dpos) * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) # <<<<<<<<<<<<<< * bin0_max = < long > floor(fbin0_max) * */ __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min)); /* "splitPixel.pyx":187 * fbin0_max = getBinNr(max0, pos0_min, dpos) * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) # <<<<<<<<<<<<<< * * if bin0_min == bin0_max: */ __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max)); /* "splitPixel.pyx":189 * bin0_max = < long > floor(fbin0_max) * * if bin0_min == bin0_max: # <<<<<<<<<<<<<< * #All pixel is within a single bin * outCount[bin0_min] += 1.0 */ __pyx_t_14 = (__pyx_v_bin0_min == __pyx_v_bin0_max); if (__pyx_t_14) { /* "splitPixel.pyx":191 * if bin0_min == bin0_max: * #All pixel is within a single bin * outCount[bin0_min] += 1.0 # <<<<<<<<<<<<<< * outData[bin0_min] += data * */ __pyx_t_32 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_32, __pyx_bstride_0_outCount) += 1.0; /* "splitPixel.pyx":192 * #All pixel is within a single bin * outCount[bin0_min] += 1.0 * outData[bin0_min] += data # <<<<<<<<<<<<<< * * # else we have pixel spliting. */ __pyx_t_33 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_33, __pyx_bstride_0_outData) += __pyx_v_data; goto __pyx_L15; } /*else*/ { /* "splitPixel.pyx":196 * # else we have pixel spliting. * else: * aeraPixel = fbin0_max - fbin0_min # <<<<<<<<<<<<<< * deltaA = 1.0 / aeraPixel * */ __pyx_v_aeraPixel = (__pyx_v_fbin0_max - __pyx_v_fbin0_min); /* "splitPixel.pyx":197 * else: * aeraPixel = fbin0_max - fbin0_min * deltaA = 1.0 / aeraPixel # <<<<<<<<<<<<<< * * deltaL = < double > (bin0_min + 1) - fbin0_min */ __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel); /* "splitPixel.pyx":199 * deltaA = 1.0 / aeraPixel * * deltaL = < double > (bin0_min + 1) - fbin0_min # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< double > bin0_max) * */ __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitPixel.pyx":200 * * deltaL = < double > (bin0_min + 1) - fbin0_min * deltaR = fbin0_max - (< double > bin0_max) # <<<<<<<<<<<<<< * * outCount[bin0_min] += deltaA * deltaL */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max)); /* "splitPixel.pyx":202 * deltaR = fbin0_max - (< double > bin0_max) * * outCount[bin0_min] += deltaA * deltaL # <<<<<<<<<<<<<< * outData[bin0_min] += data * deltaA * deltaL * */ __pyx_t_34 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_34, __pyx_bstride_0_outCount) += (__pyx_v_deltaA * __pyx_v_deltaL); /* "splitPixel.pyx":203 * * outCount[bin0_min] += deltaA * deltaL * outData[bin0_min] += data * deltaA * deltaL # <<<<<<<<<<<<<< * * outCount[bin0_max] += deltaA * deltaR */ __pyx_t_35 = __pyx_v_bin0_min; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_35, __pyx_bstride_0_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL); /* "splitPixel.pyx":205 * outData[bin0_min] += data * deltaA * deltaL * * outCount[bin0_max] += deltaA * deltaR # <<<<<<<<<<<<<< * outData[bin0_max] += data * deltaA * deltaR * */ __pyx_t_36 = __pyx_v_bin0_max; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_36, __pyx_bstride_0_outCount) += (__pyx_v_deltaA * __pyx_v_deltaR); /* "splitPixel.pyx":206 * * outCount[bin0_max] += deltaA * deltaR * outData[bin0_max] += data * deltaA * deltaR # <<<<<<<<<<<<<< * * if bin0_min + 1 != bin0_max: */ __pyx_t_37 = __pyx_v_bin0_max; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_37, __pyx_bstride_0_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR); /* "splitPixel.pyx":208 * outData[bin0_max] += data * deltaA * deltaR * * if bin0_min + 1 != bin0_max: # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i] += deltaA */ __pyx_t_14 = ((__pyx_v_bin0_min + 1) != __pyx_v_bin0_max); if (__pyx_t_14) { /* "splitPixel.pyx":209 * * if bin0_min + 1 != bin0_max: * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i] += deltaA * outData[i] += data * deltaA */ __pyx_t_38 = __pyx_v_bin0_max; for (__pyx_t_39 = (__pyx_v_bin0_min + 1); __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) { __pyx_v_i = __pyx_t_39; /* "splitPixel.pyx":210 * if bin0_min + 1 != bin0_max: * for i in range(bin0_min + 1, bin0_max): * outCount[i] += deltaA # <<<<<<<<<<<<<< * outData[i] += data * deltaA * */ __pyx_t_40 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_40, __pyx_bstride_0_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":211 * for i in range(bin0_min + 1, bin0_max): * outCount[i] += deltaA * outData[i] += data * deltaA # <<<<<<<<<<<<<< * * for i in range(bins): */ __pyx_t_41 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_41, __pyx_bstride_0_outData) += (__pyx_v_data * __pyx_v_deltaA); } goto __pyx_L16; } __pyx_L16:; } __pyx_L15:; } /* "splitPixel.pyx":213 * outData[i] += data * deltaA * * for i in range(bins): # <<<<<<<<<<<<<< * if outCount[i] > epsilon: * outMerge[i] = outData[i] / outCount[i] */ __pyx_t_5 = __pyx_v_bins; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; /* "splitPixel.pyx":214 * * for i in range(bins): * if outCount[i] > epsilon: # <<<<<<<<<<<<<< * outMerge[i] = outData[i] / outCount[i] * else: */ __pyx_t_38 = __pyx_v_i; __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_38, __pyx_bstride_0_outCount)) > __pyx_v_epsilon); if (__pyx_t_14) { /* "splitPixel.pyx":215 * for i in range(bins): * if outCount[i] > epsilon: * outMerge[i] = outData[i] / outCount[i] # <<<<<<<<<<<<<< * else: * outMerge[i] = dummy */ __pyx_t_39 = __pyx_v_i; __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_43, __pyx_bstride_0_outMerge) = ((*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_39, __pyx_bstride_0_outData)) / (*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_42, __pyx_bstride_0_outCount))); goto __pyx_L21; } /*else*/ { /* "splitPixel.pyx":217 * outMerge[i] = outData[i] / outCount[i] * else: * outMerge[i] = dummy # <<<<<<<<<<<<<< * * return outPos, outMerge, outData, outCount */ __pyx_t_44 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_44, __pyx_bstride_0_outMerge) = __pyx_v_dummy; } __pyx_L21:; } } /* "splitPixel.pyx":171 * cdef double epsilon = 1e-10 * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins): * outPos[i] = pos0_min + (0.5 +< double > i) * dpos */ /*finally:*/ { Py_BLOCK_THREADS } } /* "splitPixel.pyx":219 * outMerge[i] = dummy * * return outPos, outMerge, outData, outCount # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_outPos)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos)); __Pyx_INCREF(((PyObject *)__pyx_v_outMerge)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge)); __Pyx_INCREF(((PyObject *)__pyx_v_outData)); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_outData)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outData)); __Pyx_INCREF(((PyObject *)__pyx_v_outCount)); PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount)); __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 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_8); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("splitPixel.fullSplit1D", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cpos); __Pyx_XDECREF((PyObject *)__pyx_v_cdata); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_outPos); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "splitPixel.pyx":229 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit2D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * bins not None, */ static PyObject *__pyx_pf_10splitPixel_1fullSplit2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_10splitPixel_1fullSplit2D[] = "\n Calculate 2D histogram of pos weighted by weights\n \n Splitting is done on the pixel's bounding box like fit2D\n \n \n @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi\n @param weights: array with intensities\n @param bins: number of output bins int or 2-tuple of int\n @param pos0Range: minimum and maximum of the 2th range\n @param pos1Range: minimum and maximum of the chi range\n @param dummy: value for bins without pixels \n @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n "; static PyMethodDef __pyx_mdef_10splitPixel_1fullSplit2D = {__Pyx_NAMESTR("fullSplit2D"), (PyCFunction)__pyx_pf_10splitPixel_1fullSplit2D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10splitPixel_1fullSplit2D)}; static PyObject *__pyx_pf_10splitPixel_1fullSplit2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_pos = 0; PyArrayObject *__pyx_v_weights = 0; PyObject *__pyx_v_bins = 0; PyObject *__pyx_v_pos0Range = 0; PyObject *__pyx_v_pos1Range = 0; double __pyx_v_dummy; long __pyx_v_bins0; long __pyx_v_bins1; long __pyx_v_i; long __pyx_v_j; long __pyx_v_idx; long __pyx_v_size; PyArrayObject *__pyx_v_cpos = 0; PyArrayObject *__pyx_v_cdata = 0; PyArrayObject *__pyx_v_outData = 0; PyArrayObject *__pyx_v_outCount = 0; PyArrayObject *__pyx_v_outMerge = 0; PyArrayObject *__pyx_v_edges0 = 0; PyArrayObject *__pyx_v_edges1 = 0; double __pyx_v_min0; double __pyx_v_max0; double __pyx_v_min1; double __pyx_v_max1; double __pyx_v_deltaR; double __pyx_v_deltaL; double __pyx_v_deltaU; double __pyx_v_deltaD; double __pyx_v_deltaA; double __pyx_v_pos0_min; double __pyx_v_pos0_max; double __pyx_v_pos1_min; double __pyx_v_pos1_max; double __pyx_v_pos0_maxin; double __pyx_v_pos1_maxin; double __pyx_v_fbin0_min; double __pyx_v_fbin0_max; double __pyx_v_fbin1_min; double __pyx_v_fbin1_max; long __pyx_v_bin0_max; long __pyx_v_bin0_min; long __pyx_v_bin1_max; long __pyx_v_bin1_min; double __pyx_v_aeraPixel; double __pyx_v_a0; double __pyx_v_a1; double __pyx_v_b0; double __pyx_v_b1; double __pyx_v_c0; double __pyx_v_c1; double __pyx_v_d0; double __pyx_v_d1; double __pyx_v_epsilon; double __pyx_v_dpos0; double __pyx_v_dpos1; double __pyx_v_data; Py_buffer __pyx_bstruct_edges0; Py_ssize_t __pyx_bstride_0_edges0 = 0; Py_ssize_t __pyx_bshape_0_edges0 = 0; Py_buffer __pyx_bstruct_edges1; Py_ssize_t __pyx_bstride_0_edges1 = 0; Py_ssize_t __pyx_bshape_0_edges1 = 0; Py_buffer __pyx_bstruct_outMerge; Py_ssize_t __pyx_bstride_0_outMerge = 0; Py_ssize_t __pyx_bstride_1_outMerge = 0; Py_ssize_t __pyx_bshape_0_outMerge = 0; Py_ssize_t __pyx_bshape_1_outMerge = 0; Py_buffer __pyx_bstruct_outCount; Py_ssize_t __pyx_bstride_0_outCount = 0; Py_ssize_t __pyx_bstride_1_outCount = 0; Py_ssize_t __pyx_bshape_0_outCount = 0; Py_ssize_t __pyx_bshape_1_outCount = 0; Py_buffer __pyx_bstruct_cdata; Py_ssize_t __pyx_bstride_0_cdata = 0; Py_ssize_t __pyx_bshape_0_cdata = 0; Py_buffer __pyx_bstruct_cpos; Py_ssize_t __pyx_bstride_0_cpos = 0; Py_ssize_t __pyx_bstride_1_cpos = 0; Py_ssize_t __pyx_bstride_2_cpos = 0; Py_ssize_t __pyx_bshape_0_cpos = 0; Py_ssize_t __pyx_bshape_1_cpos = 0; Py_ssize_t __pyx_bshape_2_cpos = 0; Py_buffer __pyx_bstruct_outData; Py_ssize_t __pyx_bstride_0_outData = 0; Py_ssize_t __pyx_bstride_1_outData = 0; Py_ssize_t __pyx_bshape_0_outData = 0; Py_ssize_t __pyx_bshape_1_outData = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; long __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; long __pyx_t_9; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyArrayObject *__pyx_t_13 = NULL; PyArrayObject *__pyx_t_14 = NULL; PyArrayObject *__pyx_t_15 = NULL; PyArrayObject *__pyx_t_16 = NULL; PyArrayObject *__pyx_t_17 = NULL; Py_ssize_t __pyx_t_18; int __pyx_t_19; int __pyx_t_20; double __pyx_t_21; long __pyx_t_22; long __pyx_t_23; long __pyx_t_24; long __pyx_t_25; long __pyx_t_26; long __pyx_t_27; long __pyx_t_28; long __pyx_t_29; long __pyx_t_30; long __pyx_t_31; long __pyx_t_32; long __pyx_t_33; long __pyx_t_34; long __pyx_t_35; long __pyx_t_36; long __pyx_t_37; long __pyx_t_38; long __pyx_t_39; long __pyx_t_40; long __pyx_t_41; long __pyx_t_42; long __pyx_t_43; long __pyx_t_44; long __pyx_t_45; long __pyx_t_46; long __pyx_t_47; long __pyx_t_48; long __pyx_t_49; long __pyx_t_50; long __pyx_t_51; long __pyx_t_52; long __pyx_t_53; long __pyx_t_54; long __pyx_t_55; long __pyx_t_56; long __pyx_t_57; long __pyx_t_58; long __pyx_t_59; long __pyx_t_60; long __pyx_t_61; long __pyx_t_62; long __pyx_t_63; long __pyx_t_64; long __pyx_t_65; long __pyx_t_66; long __pyx_t_67; long __pyx_t_68; long __pyx_t_69; long __pyx_t_70; long __pyx_t_71; long __pyx_t_72; long __pyx_t_73; long __pyx_t_74; long __pyx_t_75; long __pyx_t_76; long __pyx_t_77; long __pyx_t_78; long __pyx_t_79; long __pyx_t_80; long __pyx_t_81; long __pyx_t_82; long __pyx_t_83; long __pyx_t_84; long __pyx_t_85; long __pyx_t_86; long __pyx_t_87; long __pyx_t_88; long __pyx_t_89; long __pyx_t_90; long __pyx_t_91; long __pyx_t_92; long __pyx_t_93; long __pyx_t_94; long __pyx_t_95; long __pyx_t_96; long __pyx_t_97; long __pyx_t_98; long __pyx_t_99; long __pyx_t_100; long __pyx_t_101; long __pyx_t_102; long __pyx_t_103; long __pyx_t_104; long __pyx_t_105; long __pyx_t_106; long __pyx_t_107; long __pyx_t_108; long __pyx_t_109; long __pyx_t_110; long __pyx_t_111; long __pyx_t_112; long __pyx_t_113; long __pyx_t_114; long __pyx_t_115; long __pyx_t_116; long __pyx_t_117; long __pyx_t_118; long __pyx_t_119; long __pyx_t_120; long __pyx_t_121; long __pyx_t_122; long __pyx_t_123; long __pyx_t_124; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0}; __Pyx_RefNannySetupContext("fullSplit2D"); __pyx_self = __pyx_self; { PyObject* values[6] = {0,0,0,0,0,0}; /* "splitPixel.pyx":232 * numpy.ndarray weights not None, * bins not None, * pos0Range=None, # <<<<<<<<<<<<<< * pos1Range=None, * double dummy=0.0): */ values[3] = ((PyObject *)Py_None); /* "splitPixel.pyx":233 * bins not None, * pos0Range=None, * pos1Range=None, # <<<<<<<<<<<<<< * double dummy=0.0): * """ */ values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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 (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy); if (value) { values[5] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fullSplit2D") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { 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); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pos = ((PyArrayObject *)values[0]); __pyx_v_weights = ((PyArrayObject *)values[1]); __pyx_v_bins = values[2]; __pyx_v_pos0Range = values[3]; __pyx_v_pos1Range = values[4]; if (values[5]) { __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "splitPixel.pyx":234 * pos0Range=None, * pos1Range=None, * double dummy=0.0): # <<<<<<<<<<<<<< * """ * Calculate 2D histogram of pos weighted by weights */ __pyx_v_dummy = ((double)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_cpos.buf = NULL; __pyx_bstruct_cdata.buf = NULL; __pyx_bstruct_outData.buf = NULL; __pyx_bstruct_outCount.buf = NULL; __pyx_bstruct_outMerge.buf = NULL; __pyx_bstruct_edges0.buf = NULL; __pyx_bstruct_edges1.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_bins) == Py_None)) { PyErr_Format(PyExc_TypeError, "Argument 'bins' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /* "splitPixel.pyx":250 * """ * cdef long bins0, bins1, i, j, idx * cdef long size = weights.size # <<<<<<<<<<<<<< * assert pos.shape[0] == weights.size * assert pos.shape[1] == 4 # 4 corners */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_2; /* "splitPixel.pyx":251 * cdef long bins0, bins1, i, j, idx * cdef long size = weights.size * assert pos.shape[0] == weights.size # <<<<<<<<<<<<<< * assert pos.shape[1] == 4 # 4 corners * assert pos.shape[2] == 2 # tth and chi */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":252 * cdef long size = weights.size * assert pos.shape[0] == weights.size * assert pos.shape[1] == 4 # 4 corners # <<<<<<<<<<<<<< * assert pos.shape[2] == 2 # tth and chi * assert pos.ndim == 3 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":253 * assert pos.shape[0] == weights.size * assert pos.shape[1] == 4 # 4 corners * assert pos.shape[2] == 2 # tth and chi # <<<<<<<<<<<<<< * assert pos.ndim == 3 * try: */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":254 * assert pos.shape[1] == 4 # 4 corners * assert pos.shape[2] == 2 # tth and chi * assert pos.ndim == 3 # <<<<<<<<<<<<<< * try: * bins0, bins1 = tuple(bins) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_pos->nd == 3))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "splitPixel.pyx":255 * assert pos.shape[2] == 2 # tth and chi * assert pos.ndim == 3 * try: # <<<<<<<<<<<<<< * bins0, bins1 = tuple(bins) * except: */ { __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:*/ { /* "splitPixel.pyx":256 * assert pos.ndim == 3 * try: * bins0, bins1 = tuple(bins) # <<<<<<<<<<<<<< * except: * bins0 = bins1 = < long > bins */ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(__pyx_v_bins); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bins); __Pyx_GIVEREF(__pyx_v_bins); __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (likely(PyTuple_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __Pyx_UnpackTupleError(__pyx_t_3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} } __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_bins0 = __pyx_t_2; __pyx_v_bins1 = __pyx_t_9; } __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_L13_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "splitPixel.pyx":257 * try: * bins0, bins1 = tuple(bins) * except: # <<<<<<<<<<<<<< * bins0 = bins1 = < long > bins * if bins0 <= 0: */ /*except:*/ { __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); /* "splitPixel.pyx":258 * bins0, bins1 = tuple(bins) * except: * bins0 = bins1 = < long > bins # <<<<<<<<<<<<<< * if bins0 <= 0: * bins0 = 1 */ __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __pyx_v_bins0 = ((long)__pyx_t_9); __pyx_v_bins1 = ((long)__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L7_exception_handled; } __pyx_L8_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_L7_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_L13_try_end:; } /* "splitPixel.pyx":259 * except: * bins0 = bins1 = < long > bins * if bins0 <= 0: # <<<<<<<<<<<<<< * bins0 = 1 * if bins1 <= 0: */ __pyx_t_5 = (__pyx_v_bins0 <= 0); if (__pyx_t_5) { /* "splitPixel.pyx":260 * bins0 = bins1 = < long > bins * if bins0 <= 0: * bins0 = 1 # <<<<<<<<<<<<<< * if bins1 <= 0: * bins1 = 1 */ __pyx_v_bins0 = 1; goto __pyx_L16; } __pyx_L16:; /* "splitPixel.pyx":261 * if bins0 <= 0: * bins0 = 1 * if bins1 <= 0: # <<<<<<<<<<<<<< * bins1 = 1 * */ __pyx_t_5 = (__pyx_v_bins1 <= 0); if (__pyx_t_5) { /* "splitPixel.pyx":262 * bins0 = 1 * if bins1 <= 0: * bins1 = 1 # <<<<<<<<<<<<<< * * */ __pyx_v_bins1 = 1; goto __pyx_L17; } __pyx_L17:; /* "splitPixel.pyx":265 * * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0]; __pyx_bstride_1_cpos = __pyx_bstruct_cpos.strides[1]; __pyx_bstride_2_cpos = __pyx_bstruct_cpos.strides[2]; __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0]; __pyx_bshape_1_cpos = __pyx_bstruct_cpos.shape[1]; __pyx_bshape_2_cpos = __pyx_bstruct_cpos.shape[2]; } } __pyx_t_10 = 0; __pyx_v_cpos = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitPixel.pyx":266 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __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_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0]; __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0]; } } __pyx_t_11 = 0; __pyx_v_cdata = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitPixel.pyx":267 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_12)); __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_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; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bstride_1_outData = __pyx_bstruct_outData.strides[1]; __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; __pyx_bshape_1_outData = __pyx_bstruct_outData.shape[1]; } } __pyx_t_13 = 0; __pyx_v_outData = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitPixel.pyx":268 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_12, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bstride_1_outCount = __pyx_bstruct_outCount.strides[1]; __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; __pyx_bshape_1_outCount = __pyx_bstruct_outCount.shape[1]; } } __pyx_t_14 = 0; __pyx_v_outCount = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitPixel.pyx":269 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __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 = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_12)); __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_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; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 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 = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bstride_1_outMerge = __pyx_bstruct_outMerge.strides[1]; __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; __pyx_bshape_1_outMerge = __pyx_bstruct_outMerge.shape[1]; } } __pyx_t_15 = 0; __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "splitPixel.pyx":270 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64") * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 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 = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_12, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges0, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges0.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_edges0 = __pyx_bstruct_edges0.strides[0]; __pyx_bshape_0_edges0 = __pyx_bstruct_edges0.shape[0]; } } __pyx_t_16 = 0; __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "splitPixel.pyx":271 * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64") # <<<<<<<<<<<<<< * * cdef double min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_12); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges1, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges1.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_edges1 = __pyx_bstruct_edges1.strides[0]; __pyx_bshape_0_edges1 = __pyx_bstruct_edges1.shape[0]; } } __pyx_t_17 = 0; __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; /* "splitPixel.pyx":279 * cdef long bin0_max, bin0_min, bin1_max, bin1_min * cdef double aeraPixel, a0, a1, b0, b1, c0, c1, d0, d1 * cdef double epsilon = 1e-10 # <<<<<<<<<<<<<< * * if pos0Range is not None and len(pos0Range) == 2: */ __pyx_v_epsilon = 1e-10; /* "splitPixel.pyx":281 * cdef double epsilon = 1e-10 * * if pos0Range is not None and len(pos0Range) == 2: # <<<<<<<<<<<<<< * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) */ __pyx_t_5 = (__pyx_v_pos0Range != Py_None); if (__pyx_t_5) { __pyx_t_18 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (__pyx_t_18 == 2); __pyx_t_20 = __pyx_t_19; } else { __pyx_t_20 = __pyx_t_5; } if (__pyx_t_20) { /* "splitPixel.pyx":282 * * if pos0Range is not None and len(pos0Range) == 2: * pos0_min = min(pos0Range) # <<<<<<<<<<<<<< * pos0_maxin = max(pos0Range) * else: */ __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos0_min = __pyx_t_21; /* "splitPixel.pyx":283 * if pos0Range is not None and len(pos0Range) == 2: * pos0_min = min(pos0Range) * pos0_maxin = max(pos0Range) # <<<<<<<<<<<<<< * else: * pos0_min = pos[:, :, 0].min() */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_pos0Range); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range); __Pyx_GIVEREF(__pyx_v_pos0Range); __pyx_t_12 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_pos0_maxin = __pyx_t_21; goto __pyx_L18; } /*else*/ { /* "splitPixel.pyx":285 * pos0_maxin = max(pos0Range) * else: * pos0_min = pos[:, :, 0].min() # <<<<<<<<<<<<<< * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_19)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_pos0_min = __pyx_t_21; /* "splitPixel.pyx":286 * else: * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * */ __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_22)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_pos0_maxin = __pyx_t_21; } __pyx_L18:; /* "splitPixel.pyx":287 * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * * if pos1Range is not None and len(pos1Range) > 1: */ __pyx_t_12 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__double); 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_DECREF(__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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Add(__pyx_int_1, __pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_t_12, __pyx_t_4); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos0_max = __pyx_t_21; /* "splitPixel.pyx":289 * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * * if pos1Range is not None and len(pos1Range) > 1: # <<<<<<<<<<<<<< * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) */ __pyx_t_20 = (__pyx_v_pos1Range != Py_None); if (__pyx_t_20) { __pyx_t_18 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = (__pyx_t_18 > 1); __pyx_t_19 = __pyx_t_5; } else { __pyx_t_19 = __pyx_t_20; } if (__pyx_t_19) { /* "splitPixel.pyx":290 * * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) # <<<<<<<<<<<<<< * pos1_maxin = max(pos1Range) * else: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_pos1_min = __pyx_t_21; /* "splitPixel.pyx":291 * if pos1Range is not None and len(pos1Range) > 1: * pos1_min = min(pos1Range) * pos1_maxin = max(pos1Range) # <<<<<<<<<<<<<< * else: * pos1_min = pos[:, :, 1].min() */ __pyx_t_4 = PyTuple_New(1); 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_INCREF(__pyx_v_pos1Range); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos1Range); __Pyx_GIVEREF(__pyx_v_pos1Range); __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_maxin = __pyx_t_21; goto __pyx_L19; } /*else*/ { /* "splitPixel.pyx":293 * pos1_maxin = max(pos1Range) * else: * pos1_min = pos[:, :, 1].min() # <<<<<<<<<<<<<< * pos1_maxin = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_25)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__min); 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_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_min = __pyx_t_21; /* "splitPixel.pyx":294 * else: * pos1_min = pos[:, :, 1].min() * pos1_maxin = pos[:, :, 1].max() # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * */ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pos1_maxin = __pyx_t_21; } __pyx_L19:; /* "splitPixel.pyx":295 * pos1_min = pos[:, :, 1].min() * pos1_maxin = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) # <<<<<<<<<<<<<< * * cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0)) */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos1_maxin); 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_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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); __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__finfo); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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); __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); 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(__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 = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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_12, ((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(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); 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); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_4); 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(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); 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); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_pos1_max = __pyx_t_21; /* "splitPixel.pyx":297 * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * * cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0)) # <<<<<<<<<<<<<< * cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1)) * */ __pyx_v_dpos0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((double)__pyx_v_bins0)); /* "splitPixel.pyx":298 * * cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0)) * cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1)) # <<<<<<<<<<<<<< * * with nogil: */ __pyx_v_dpos1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((double)__pyx_v_bins1)); /* "splitPixel.pyx":300 * cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1)) * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "splitPixel.pyx":301 * * with nogil: * for i in range(bins0): # <<<<<<<<<<<<<< * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): */ __pyx_t_9 = __pyx_v_bins0; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitPixel.pyx":302 * with nogil: * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 # <<<<<<<<<<<<<< * for i in range(bins1): * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 */ __pyx_t_22 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_edges0.buf, __pyx_t_22, __pyx_bstride_0_edges0) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos0)); } /* "splitPixel.pyx":303 * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): # <<<<<<<<<<<<<< * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 * */ __pyx_t_9 = __pyx_v_bins1; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitPixel.pyx":304 * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 * for i in range(bins1): * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 # <<<<<<<<<<<<<< * * for idx in range(size): */ __pyx_t_23 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_edges1.buf, __pyx_t_23, __pyx_bstride_0_edges1) = (__pyx_v_pos1_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos1)); } /* "splitPixel.pyx":306 * edges1[i] = pos1_min + (0.5 +< double > i) * dpos1 * * for idx in range(size): # <<<<<<<<<<<<<< * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] */ __pyx_t_9 = __pyx_v_size; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_idx = __pyx_t_2; /* "splitPixel.pyx":307 * * for idx in range(size): * data = < double > cdata[idx] # <<<<<<<<<<<<<< * a0 = < double > cpos[idx, 0, 0] * a1 = < double > cpos[idx, 0, 1] */ __pyx_t_24 = __pyx_v_idx; __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_24, __pyx_bstride_0_cdata))); /* "splitPixel.pyx":308 * for idx in range(size): * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] # <<<<<<<<<<<<<< * a1 = < double > cpos[idx, 0, 1] * b0 = < double > cpos[idx, 1, 0] */ __pyx_t_25 = __pyx_v_idx; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_v_a0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_25, __pyx_bstride_0_cpos, __pyx_t_26, __pyx_bstride_1_cpos, __pyx_t_27, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":309 * data = < double > cdata[idx] * a0 = < double > cpos[idx, 0, 0] * a1 = < double > cpos[idx, 0, 1] # <<<<<<<<<<<<<< * b0 = < double > cpos[idx, 1, 0] * b1 = < double > cpos[idx, 1, 1] */ __pyx_t_28 = __pyx_v_idx; __pyx_t_29 = 0; __pyx_t_30 = 1; __pyx_v_a1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_28, __pyx_bstride_0_cpos, __pyx_t_29, __pyx_bstride_1_cpos, __pyx_t_30, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":310 * a0 = < double > cpos[idx, 0, 0] * a1 = < double > cpos[idx, 0, 1] * b0 = < double > cpos[idx, 1, 0] # <<<<<<<<<<<<<< * b1 = < double > cpos[idx, 1, 1] * c0 = < double > cpos[idx, 2, 0] */ __pyx_t_31 = __pyx_v_idx; __pyx_t_32 = 1; __pyx_t_33 = 0; __pyx_v_b0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_31, __pyx_bstride_0_cpos, __pyx_t_32, __pyx_bstride_1_cpos, __pyx_t_33, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":311 * a1 = < double > cpos[idx, 0, 1] * b0 = < double > cpos[idx, 1, 0] * b1 = < double > cpos[idx, 1, 1] # <<<<<<<<<<<<<< * c0 = < double > cpos[idx, 2, 0] * c1 = < double > cpos[idx, 2, 1] */ __pyx_t_34 = __pyx_v_idx; __pyx_t_35 = 1; __pyx_t_36 = 1; __pyx_v_b1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_34, __pyx_bstride_0_cpos, __pyx_t_35, __pyx_bstride_1_cpos, __pyx_t_36, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":312 * b0 = < double > cpos[idx, 1, 0] * b1 = < double > cpos[idx, 1, 1] * c0 = < double > cpos[idx, 2, 0] # <<<<<<<<<<<<<< * c1 = < double > cpos[idx, 2, 1] * d0 = < double > cpos[idx, 3, 0] */ __pyx_t_37 = __pyx_v_idx; __pyx_t_38 = 2; __pyx_t_39 = 0; __pyx_v_c0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_37, __pyx_bstride_0_cpos, __pyx_t_38, __pyx_bstride_1_cpos, __pyx_t_39, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":313 * b1 = < double > cpos[idx, 1, 1] * c0 = < double > cpos[idx, 2, 0] * c1 = < double > cpos[idx, 2, 1] # <<<<<<<<<<<<<< * d0 = < double > cpos[idx, 3, 0] * d1 = < double > cpos[idx, 3, 1] */ __pyx_t_40 = __pyx_v_idx; __pyx_t_41 = 2; __pyx_t_42 = 1; __pyx_v_c1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_40, __pyx_bstride_0_cpos, __pyx_t_41, __pyx_bstride_1_cpos, __pyx_t_42, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":314 * c0 = < double > cpos[idx, 2, 0] * c1 = < double > cpos[idx, 2, 1] * d0 = < double > cpos[idx, 3, 0] # <<<<<<<<<<<<<< * d1 = < double > cpos[idx, 3, 1] * */ __pyx_t_43 = __pyx_v_idx; __pyx_t_44 = 3; __pyx_t_45 = 0; __pyx_v_d0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_43, __pyx_bstride_0_cpos, __pyx_t_44, __pyx_bstride_1_cpos, __pyx_t_45, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":315 * c1 = < double > cpos[idx, 2, 1] * d0 = < double > cpos[idx, 3, 0] * d1 = < double > cpos[idx, 3, 1] # <<<<<<<<<<<<<< * * min0 = min4f(a0, b0, c0, d0) */ __pyx_t_46 = __pyx_v_idx; __pyx_t_47 = 3; __pyx_t_48 = 1; __pyx_v_d1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_46, __pyx_bstride_0_cpos, __pyx_t_47, __pyx_bstride_1_cpos, __pyx_t_48, __pyx_bstride_2_cpos))); /* "splitPixel.pyx":317 * d1 = < double > cpos[idx, 3, 1] * * min0 = min4f(a0, b0, c0, d0) # <<<<<<<<<<<<<< * max0 = max4f(a0, b0, c0, d0) * min1 = min4f(a1, b1, c1, d1) */ __pyx_v_min0 = __pyx_f_10splitPixel_min4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0); /* "splitPixel.pyx":318 * * min0 = min4f(a0, b0, c0, d0) * max0 = max4f(a0, b0, c0, d0) # <<<<<<<<<<<<<< * min1 = min4f(a1, b1, c1, d1) * max1 = max4f(a1, b1, c1, d1) */ __pyx_v_max0 = __pyx_f_10splitPixel_max4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0); /* "splitPixel.pyx":319 * min0 = min4f(a0, b0, c0, d0) * max0 = max4f(a0, b0, c0, d0) * min1 = min4f(a1, b1, c1, d1) # <<<<<<<<<<<<<< * max1 = max4f(a1, b1, c1, d1) * # splitOnePixel2D(min0, max0, min1, max1, */ __pyx_v_min1 = __pyx_f_10splitPixel_min4f(__pyx_v_a1, __pyx_v_b1, __pyx_v_c1, __pyx_v_d1); /* "splitPixel.pyx":320 * max0 = max4f(a0, b0, c0, d0) * min1 = min4f(a1, b1, c1, d1) * max1 = max4f(a1, b1, c1, d1) # <<<<<<<<<<<<<< * # splitOnePixel2D(min0, max0, min1, max1, * # data, */ __pyx_v_max1 = __pyx_f_10splitPixel_max4f(__pyx_v_a1, __pyx_v_b1, __pyx_v_c1, __pyx_v_d1); /* "splitPixel.pyx":328 * # outData) * * if max0 < pos0_min: # <<<<<<<<<<<<<< * with gil: * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) */ __pyx_t_19 = (__pyx_v_max0 < __pyx_v_pos0_min); if (__pyx_t_19) { /* "splitPixel.pyx":329 * * if max0 < pos0_min: * with gil: # <<<<<<<<<<<<<< * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) * continue */ { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif /*try:*/ { /* "splitPixel.pyx":330 * if max0 < pos0_min: * with gil: * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) # <<<<<<<<<<<<<< * continue * if max1 < pos1_min: */ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; } /* "splitPixel.pyx":329 * * if max0 < pos0_min: * with gil: # <<<<<<<<<<<<<< * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) * continue */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L34; __pyx_L33: __pyx_why = 4; goto __pyx_L34; __pyx_L34:; #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif switch (__pyx_why) { case 4: goto __pyx_L21; } } } /* "splitPixel.pyx":331 * with gil: * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) * continue # <<<<<<<<<<<<<< * if max1 < pos1_min: * with gil: */ goto __pyx_L27_continue; goto __pyx_L29; } __pyx_L29:; /* "splitPixel.pyx":332 * print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min)) * continue * if max1 < pos1_min: # <<<<<<<<<<<<<< * with gil: * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) */ __pyx_t_19 = (__pyx_v_max1 < __pyx_v_pos1_min); if (__pyx_t_19) { /* "splitPixel.pyx":333 * continue * if max1 < pos1_min: * with gil: # <<<<<<<<<<<<<< * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) * continue */ { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif /*try:*/ { /* "splitPixel.pyx":334 * if max1 < pos1_min: * with gil: * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) # <<<<<<<<<<<<<< * continue * if min0 > pos0_maxin: */ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } /* "splitPixel.pyx":333 * continue * if max1 < pos1_min: * with gil: # <<<<<<<<<<<<<< * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) * continue */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L41; __pyx_L40: __pyx_why = 4; goto __pyx_L41; __pyx_L41:; #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif switch (__pyx_why) { case 4: goto __pyx_L21; } } } /* "splitPixel.pyx":335 * with gil: * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) * continue # <<<<<<<<<<<<<< * if min0 > pos0_maxin: * with gil: */ goto __pyx_L27_continue; goto __pyx_L36; } __pyx_L36:; /* "splitPixel.pyx":336 * print("max1 (%s) < pos1_min %s" % (max0 , pos0_min)) * continue * if min0 > pos0_maxin: # <<<<<<<<<<<<<< * with gil: * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) */ __pyx_t_19 = (__pyx_v_min0 > __pyx_v_pos0_maxin); if (__pyx_t_19) { /* "splitPixel.pyx":337 * continue * if min0 > pos0_maxin: * with gil: # <<<<<<<<<<<<<< * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) * continue */ { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif /*try:*/ { /* "splitPixel.pyx":338 * if min0 > pos0_maxin: * with gil: * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) # <<<<<<<<<<<<<< * continue * if min1 > pos1_maxin: */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } /* "splitPixel.pyx":337 * continue * if min0 > pos0_maxin: * with gil: # <<<<<<<<<<<<<< * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) * continue */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L48; __pyx_L47: __pyx_why = 4; goto __pyx_L48; __pyx_L48:; #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif switch (__pyx_why) { case 4: goto __pyx_L21; } } } /* "splitPixel.pyx":339 * with gil: * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) * continue # <<<<<<<<<<<<<< * if min1 > pos1_maxin: * with gil: */ goto __pyx_L27_continue; goto __pyx_L43; } __pyx_L43:; /* "splitPixel.pyx":340 * print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin)) * continue * if min1 > pos1_maxin: # <<<<<<<<<<<<<< * with gil: * print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) */ __pyx_t_19 = (__pyx_v_min1 > __pyx_v_pos1_maxin); if (__pyx_t_19) { /* "splitPixel.pyx":341 * continue * if min1 > pos1_maxin: * with gil: # <<<<<<<<<<<<<< * print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) * continue */ { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif /*try:*/ { /* "splitPixel.pyx":342 * if min1 > pos1_maxin: * with gil: * print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) # <<<<<<<<<<<<<< * continue * */ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; } /* "splitPixel.pyx":341 * continue * if min1 > pos1_maxin: * with gil: # <<<<<<<<<<<<<< * print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) * continue */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L55; __pyx_L54: __pyx_why = 4; goto __pyx_L55; __pyx_L55:; #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif switch (__pyx_why) { case 4: goto __pyx_L21; } } } /* "splitPixel.pyx":343 * with gil: * print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin)) * continue # <<<<<<<<<<<<<< * * if min0 < pos0_min: */ goto __pyx_L27_continue; goto __pyx_L50; } __pyx_L50:; /* "splitPixel.pyx":345 * continue * * if min0 < pos0_min: # <<<<<<<<<<<<<< * data = data * (pos0_min - min0) / (max0 - min0) * min0 = pos0_min */ __pyx_t_19 = (__pyx_v_min0 < __pyx_v_pos0_min); if (__pyx_t_19) { /* "splitPixel.pyx":346 * * if min0 < pos0_min: * data = data * (pos0_min - min0) / (max0 - min0) # <<<<<<<<<<<<<< * min0 = pos0_min * if min1 < pos1_min: */ __pyx_v_data = ((__pyx_v_data * (__pyx_v_pos0_min - __pyx_v_min0)) / (__pyx_v_max0 - __pyx_v_min0)); /* "splitPixel.pyx":347 * if min0 < pos0_min: * data = data * (pos0_min - min0) / (max0 - min0) * min0 = pos0_min # <<<<<<<<<<<<<< * if min1 < pos1_min: * data = data * (pos1_min - min1) / (max1 - min1) */ __pyx_v_min0 = __pyx_v_pos0_min; goto __pyx_L57; } __pyx_L57:; /* "splitPixel.pyx":348 * data = data * (pos0_min - min0) / (max0 - min0) * min0 = pos0_min * if min1 < pos1_min: # <<<<<<<<<<<<<< * data = data * (pos1_min - min1) / (max1 - min1) * min1 = pos1_min */ __pyx_t_19 = (__pyx_v_min1 < __pyx_v_pos1_min); if (__pyx_t_19) { /* "splitPixel.pyx":349 * min0 = pos0_min * if min1 < pos1_min: * data = data * (pos1_min - min1) / (max1 - min1) # <<<<<<<<<<<<<< * min1 = pos1_min * if max0 > pos0_maxin: */ __pyx_v_data = ((__pyx_v_data * (__pyx_v_pos1_min - __pyx_v_min1)) / (__pyx_v_max1 - __pyx_v_min1)); /* "splitPixel.pyx":350 * if min1 < pos1_min: * data = data * (pos1_min - min1) / (max1 - min1) * min1 = pos1_min # <<<<<<<<<<<<<< * if max0 > pos0_maxin: * data = data * (max0 - pos0_maxin) / (max0 - min0) */ __pyx_v_min1 = __pyx_v_pos1_min; goto __pyx_L58; } __pyx_L58:; /* "splitPixel.pyx":351 * data = data * (pos1_min - min1) / (max1 - min1) * min1 = pos1_min * if max0 > pos0_maxin: # <<<<<<<<<<<<<< * data = data * (max0 - pos0_maxin) / (max0 - min0) * max0 = pos0_maxin */ __pyx_t_19 = (__pyx_v_max0 > __pyx_v_pos0_maxin); if (__pyx_t_19) { /* "splitPixel.pyx":352 * min1 = pos1_min * if max0 > pos0_maxin: * data = data * (max0 - pos0_maxin) / (max0 - min0) # <<<<<<<<<<<<<< * max0 = pos0_maxin * if max1 > pos1_maxin: */ __pyx_v_data = ((__pyx_v_data * (__pyx_v_max0 - __pyx_v_pos0_maxin)) / (__pyx_v_max0 - __pyx_v_min0)); /* "splitPixel.pyx":353 * if max0 > pos0_maxin: * data = data * (max0 - pos0_maxin) / (max0 - min0) * max0 = pos0_maxin # <<<<<<<<<<<<<< * if max1 > pos1_maxin: * data = data * (max1 - pos1_maxin) / (max1 - min1) */ __pyx_v_max0 = __pyx_v_pos0_maxin; goto __pyx_L59; } __pyx_L59:; /* "splitPixel.pyx":354 * data = data * (max0 - pos0_maxin) / (max0 - min0) * max0 = pos0_maxin * if max1 > pos1_maxin: # <<<<<<<<<<<<<< * data = data * (max1 - pos1_maxin) / (max1 - min1) * max1 = pos1_maxin */ __pyx_t_19 = (__pyx_v_max1 > __pyx_v_pos1_maxin); if (__pyx_t_19) { /* "splitPixel.pyx":355 * max0 = pos0_maxin * if max1 > pos1_maxin: * data = data * (max1 - pos1_maxin) / (max1 - min1) # <<<<<<<<<<<<<< * max1 = pos1_maxin * */ __pyx_v_data = ((__pyx_v_data * (__pyx_v_max1 - __pyx_v_pos1_maxin)) / (__pyx_v_max1 - __pyx_v_min1)); /* "splitPixel.pyx":356 * if max1 > pos1_maxin: * data = data * (max1 - pos1_maxin) / (max1 - min1) * max1 = pos1_maxin # <<<<<<<<<<<<<< * * ## treat data for pixel on chi discontinuity */ __pyx_v_max1 = __pyx_v_pos1_maxin; goto __pyx_L60; } __pyx_L60:; /* "splitPixel.pyx":359 * * ## treat data for pixel on chi discontinuity * if ((max1 - min1) / dpos1) > (bins1 / 2.0): # <<<<<<<<<<<<<< * # with gil: * # print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1)) */ __pyx_t_19 = (((__pyx_v_max1 - __pyx_v_min1) / __pyx_v_dpos1) > (__pyx_v_bins1 / 2.0)); if (__pyx_t_19) { /* "splitPixel.pyx":362 * # with gil: * # print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1)) * if pos1_maxin - max1 > min1 - pos1_min: # <<<<<<<<<<<<<< * min1 = max1 * max1 = pos1_maxin */ __pyx_t_19 = ((__pyx_v_pos1_maxin - __pyx_v_max1) > (__pyx_v_min1 - __pyx_v_pos1_min)); if (__pyx_t_19) { /* "splitPixel.pyx":363 * # print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1)) * if pos1_maxin - max1 > min1 - pos1_min: * min1 = max1 # <<<<<<<<<<<<<< * max1 = pos1_maxin * else: */ __pyx_v_min1 = __pyx_v_max1; /* "splitPixel.pyx":364 * if pos1_maxin - max1 > min1 - pos1_min: * min1 = max1 * max1 = pos1_maxin # <<<<<<<<<<<<<< * else: * max1 = min1 */ __pyx_v_max1 = __pyx_v_pos1_maxin; goto __pyx_L62; } /*else*/ { /* "splitPixel.pyx":366 * max1 = pos1_maxin * else: * max1 = min1 # <<<<<<<<<<<<<< * min1 = pos1_min * */ __pyx_v_max1 = __pyx_v_min1; /* "splitPixel.pyx":367 * else: * max1 = min1 * min1 = pos1_min # <<<<<<<<<<<<<< * * fbin0_min = getBinNr(min0, pos0_min, dpos0) */ __pyx_v_min1 = __pyx_v_pos1_min; } __pyx_L62:; goto __pyx_L61; } __pyx_L61:; /* "splitPixel.pyx":369 * min1 = pos1_min * * fbin0_min = getBinNr(min0, pos0_min, dpos0) # <<<<<<<<<<<<<< * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) */ __pyx_v_fbin0_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos0); /* "splitPixel.pyx":370 * * fbin0_min = getBinNr(min0, pos0_min, dpos0) * fbin0_max = getBinNr(max0, pos0_min, dpos0) # <<<<<<<<<<<<<< * fbin1_min = getBinNr(min1, pos1_min, dpos1) * fbin1_max = getBinNr(max1, pos1_min, dpos1) */ __pyx_v_fbin0_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos0); /* "splitPixel.pyx":371 * fbin0_min = getBinNr(min0, pos0_min, dpos0) * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) # <<<<<<<<<<<<<< * fbin1_max = getBinNr(max1, pos1_min, dpos1) * */ __pyx_v_fbin1_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_dpos1); /* "splitPixel.pyx":372 * fbin0_max = getBinNr(max0, pos0_min, dpos0) * fbin1_min = getBinNr(min1, pos1_min, dpos1) * fbin1_max = getBinNr(max1, pos1_min, dpos1) # <<<<<<<<<<<<<< * * bin0_min = < long > floor(fbin0_min) */ __pyx_v_fbin1_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_dpos1); /* "splitPixel.pyx":374 * fbin1_max = getBinNr(max1, pos1_min, dpos1) * * bin0_min = < long > floor(fbin0_min) # <<<<<<<<<<<<<< * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) */ __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min)); /* "splitPixel.pyx":375 * * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) # <<<<<<<<<<<<<< * bin1_min = < long > floor(fbin1_min) * bin1_max = < long > floor(fbin1_max) */ __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max)); /* "splitPixel.pyx":376 * bin0_min = < long > floor(fbin0_min) * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) # <<<<<<<<<<<<<< * bin1_max = < long > floor(fbin1_max) * */ __pyx_v_bin1_min = ((long)floor(__pyx_v_fbin1_min)); /* "splitPixel.pyx":377 * bin0_max = < long > floor(fbin0_max) * bin1_min = < long > floor(fbin1_min) * bin1_max = < long > floor(fbin1_max) # <<<<<<<<<<<<<< * * */ __pyx_v_bin1_max = ((long)floor(__pyx_v_fbin1_max)); /* "splitPixel.pyx":380 * * * if bin0_min == bin0_max: # <<<<<<<<<<<<<< * if bin1_min == bin1_max: * #All pixel is within a single bin */ __pyx_t_19 = (__pyx_v_bin0_min == __pyx_v_bin0_max); if (__pyx_t_19) { /* "splitPixel.pyx":381 * * if bin0_min == bin0_max: * if bin1_min == bin1_max: # <<<<<<<<<<<<<< * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 */ __pyx_t_19 = (__pyx_v_bin1_min == __pyx_v_bin1_max); if (__pyx_t_19) { /* "splitPixel.pyx":383 * if bin1_min == bin1_max: * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * else: */ __pyx_t_49 = __pyx_v_bin0_min; __pyx_t_50 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_49, __pyx_bstride_0_outCount, __pyx_t_50, __pyx_bstride_1_outCount) += 1.0; /* "splitPixel.pyx":384 * #All pixel is within a single bin * outCount[bin0_min, bin1_min] += 1.0 * outData[bin0_min, bin1_min] += data # <<<<<<<<<<<<<< * else: * #spread on more than 2 bins */ __pyx_t_51 = __pyx_v_bin0_min; __pyx_t_52 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_51, __pyx_bstride_0_outData, __pyx_t_52, __pyx_bstride_1_outData) += __pyx_v_data; goto __pyx_L64; } /*else*/ { /* "splitPixel.pyx":387 * else: * #spread on more than 2 bins * aeraPixel = fbin1_max - fbin1_min # <<<<<<<<<<<<<< * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) */ __pyx_v_aeraPixel = (__pyx_v_fbin1_max - __pyx_v_fbin1_min); /* "splitPixel.pyx":388 * #spread on more than 2 bins * aeraPixel = fbin1_max - fbin1_min * deltaD = (< double > (bin1_min + 1)) - fbin1_min # <<<<<<<<<<<<<< * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / aeraPixel */ __pyx_v_deltaD = (((double)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min); /* "splitPixel.pyx":389 * aeraPixel = fbin1_max - fbin1_min * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) # <<<<<<<<<<<<<< * deltaA = 1.0 / aeraPixel * */ __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max)); /* "splitPixel.pyx":390 * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / aeraPixel # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_min] += deltaA * deltaD */ __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel); /* "splitPixel.pyx":392 * deltaA = 1.0 / aeraPixel * * outCount[bin0_min, bin1_min] += deltaA * deltaD # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * deltaA * deltaD * */ __pyx_t_53 = __pyx_v_bin0_min; __pyx_t_54 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_53, __pyx_bstride_0_outCount, __pyx_t_54, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaD); /* "splitPixel.pyx":393 * * outCount[bin0_min, bin1_min] += deltaA * deltaD * outData[bin0_min, bin1_min] += data * deltaA * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_max] += deltaA * deltaU */ __pyx_t_55 = __pyx_v_bin0_min; __pyx_t_56 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_55, __pyx_bstride_0_outData, __pyx_t_56, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD); /* "splitPixel.pyx":395 * outData[bin0_min, bin1_min] += data * deltaA * deltaD * * outCount[bin0_min, bin1_max] += deltaA * deltaU # <<<<<<<<<<<<<< * outData[bin0_min, bin1_max] += data * deltaA * deltaU * # if bin1_min +1< bin1_max: */ __pyx_t_57 = __pyx_v_bin0_min; __pyx_t_58 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_57, __pyx_bstride_0_outCount, __pyx_t_58, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaU); /* "splitPixel.pyx":396 * * outCount[bin0_min, bin1_max] += deltaA * deltaU * outData[bin0_min, bin1_max] += data * deltaA * deltaU # <<<<<<<<<<<<<< * # if bin1_min +1< bin1_max: * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_59 = __pyx_v_bin0_min; __pyx_t_60 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_59, __pyx_bstride_0_outData, __pyx_t_60, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU); /* "splitPixel.pyx":398 * outData[bin0_min, bin1_max] += data * deltaA * deltaU * # if bin1_min +1< bin1_max: * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[bin0_min, j] += deltaA * outData[bin0_min, j] += data * deltaA */ __pyx_t_61 = __pyx_v_bin1_max; for (__pyx_t_62 = (__pyx_v_bin1_min + 1); __pyx_t_62 < __pyx_t_61; __pyx_t_62+=1) { __pyx_v_j = __pyx_t_62; /* "splitPixel.pyx":399 * # if bin1_min +1< bin1_max: * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += deltaA # <<<<<<<<<<<<<< * outData[bin0_min, j] += data * deltaA * */ __pyx_t_63 = __pyx_v_bin0_min; __pyx_t_64 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_63, __pyx_bstride_0_outCount, __pyx_t_64, __pyx_bstride_1_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":400 * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += deltaA * outData[bin0_min, j] += data * deltaA # <<<<<<<<<<<<<< * * else: #spread on more than 2 bins in dim 0 */ __pyx_t_65 = __pyx_v_bin0_min; __pyx_t_66 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_65, __pyx_bstride_0_outData, __pyx_t_66, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA); } } __pyx_L64:; goto __pyx_L63; } /*else*/ { /* "splitPixel.pyx":403 * * else: #spread on more than 2 bins in dim 0 * if bin1_min == bin1_max: # <<<<<<<<<<<<<< * #All pixel fall on 1 bins in dim 1 * aeraPixel = fbin0_max - fbin0_min */ __pyx_t_19 = (__pyx_v_bin1_min == __pyx_v_bin1_max); if (__pyx_t_19) { /* "splitPixel.pyx":405 * if bin1_min == bin1_max: * #All pixel fall on 1 bins in dim 1 * aeraPixel = fbin0_max - fbin0_min # <<<<<<<<<<<<<< * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaA = deltaL / aeraPixel */ __pyx_v_aeraPixel = (__pyx_v_fbin0_max - __pyx_v_fbin0_min); /* "splitPixel.pyx":406 * #All pixel fall on 1 bins in dim 1 * aeraPixel = fbin0_max - fbin0_min * deltaL = (< double > (bin0_min + 1)) - fbin0_min # <<<<<<<<<<<<<< * deltaA = deltaL / aeraPixel * outCount[bin0_min, bin1_min] += deltaA */ __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitPixel.pyx":407 * aeraPixel = fbin0_max - fbin0_min * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaA = deltaL / aeraPixel # <<<<<<<<<<<<<< * outCount[bin0_min, bin1_min] += deltaA * outData[bin0_min, bin1_min] += data * deltaA */ __pyx_v_deltaA = (__pyx_v_deltaL / __pyx_v_aeraPixel); /* "splitPixel.pyx":408 * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaA = deltaL / aeraPixel * outCount[bin0_min, bin1_min] += deltaA # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * deltaA * deltaR = fbin0_max - (< double > bin0_max) */ __pyx_t_61 = __pyx_v_bin0_min; __pyx_t_62 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_61, __pyx_bstride_0_outCount, __pyx_t_62, __pyx_bstride_1_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":409 * deltaA = deltaL / aeraPixel * outCount[bin0_min, bin1_min] += deltaA * outData[bin0_min, bin1_min] += data * deltaA # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< double > bin0_max) * deltaA = deltaR / aeraPixel */ __pyx_t_67 = __pyx_v_bin0_min; __pyx_t_68 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_67, __pyx_bstride_0_outData, __pyx_t_68, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA); /* "splitPixel.pyx":410 * outCount[bin0_min, bin1_min] += deltaA * outData[bin0_min, bin1_min] += data * deltaA * deltaR = fbin0_max - (< double > bin0_max) # <<<<<<<<<<<<<< * deltaA = deltaR / aeraPixel * outCount[bin0_max, bin1_min] += deltaA */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max)); /* "splitPixel.pyx":411 * outData[bin0_min, bin1_min] += data * deltaA * deltaR = fbin0_max - (< double > bin0_max) * deltaA = deltaR / aeraPixel # <<<<<<<<<<<<<< * outCount[bin0_max, bin1_min] += deltaA * outData[bin0_max, bin1_min] += data * deltaA */ __pyx_v_deltaA = (__pyx_v_deltaR / __pyx_v_aeraPixel); /* "splitPixel.pyx":412 * deltaR = fbin0_max - (< double > bin0_max) * deltaA = deltaR / aeraPixel * outCount[bin0_max, bin1_min] += deltaA # <<<<<<<<<<<<<< * outData[bin0_max, bin1_min] += data * deltaA * deltaA = 1.0 / aeraPixel */ __pyx_t_69 = __pyx_v_bin0_max; __pyx_t_70 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_69, __pyx_bstride_0_outCount, __pyx_t_70, __pyx_bstride_1_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":413 * deltaA = deltaR / aeraPixel * outCount[bin0_max, bin1_min] += deltaA * outData[bin0_max, bin1_min] += data * deltaA # <<<<<<<<<<<<<< * deltaA = 1.0 / aeraPixel * for i in range(bin0_min + 1, bin0_max): */ __pyx_t_71 = __pyx_v_bin0_max; __pyx_t_72 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_71, __pyx_bstride_0_outData, __pyx_t_72, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA); /* "splitPixel.pyx":414 * outCount[bin0_max, bin1_min] += deltaA * outData[bin0_max, bin1_min] += data * deltaA * deltaA = 1.0 / aeraPixel # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA */ __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel); /* "splitPixel.pyx":415 * outData[bin0_max, bin1_min] += data * deltaA * deltaA = 1.0 / aeraPixel * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i, bin1_min] += deltaA * outData[i, bin1_min] += data * deltaA */ __pyx_t_73 = __pyx_v_bin0_max; for (__pyx_t_74 = (__pyx_v_bin0_min + 1); __pyx_t_74 < __pyx_t_73; __pyx_t_74+=1) { __pyx_v_i = __pyx_t_74; /* "splitPixel.pyx":416 * deltaA = 1.0 / aeraPixel * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA # <<<<<<<<<<<<<< * outData[i, bin1_min] += data * deltaA * else: */ __pyx_t_75 = __pyx_v_i; __pyx_t_76 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_75, __pyx_bstride_0_outCount, __pyx_t_76, __pyx_bstride_1_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":417 * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA * outData[i, bin1_min] += data * deltaA # <<<<<<<<<<<<<< * else: * #spread on n pix in dim0 and m pixel in dim1: */ __pyx_t_77 = __pyx_v_i; __pyx_t_78 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_77, __pyx_bstride_0_outData, __pyx_t_78, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA); } goto __pyx_L67; } /*else*/ { /* "splitPixel.pyx":420 * else: * #spread on n pix in dim0 and m pixel in dim1: * aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min) # <<<<<<<<<<<<<< * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaR = fbin0_max - (< double > bin0_max) */ __pyx_v_aeraPixel = ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min)); /* "splitPixel.pyx":421 * #spread on n pix in dim0 and m pixel in dim1: * aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min) * deltaL = (< double > (bin0_min + 1)) - fbin0_min # <<<<<<<<<<<<<< * deltaR = fbin0_max - (< double > bin0_max) * deltaD = (< double > (bin1_min + 1)) - fbin1_min */ __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min); /* "splitPixel.pyx":422 * aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min) * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaR = fbin0_max - (< double > bin0_max) # <<<<<<<<<<<<<< * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) */ __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max)); /* "splitPixel.pyx":423 * deltaL = (< double > (bin0_min + 1)) - fbin0_min * deltaR = fbin0_max - (< double > bin0_max) * deltaD = (< double > (bin1_min + 1)) - fbin1_min # <<<<<<<<<<<<<< * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / aeraPixel */ __pyx_v_deltaD = (((double)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min); /* "splitPixel.pyx":424 * deltaR = fbin0_max - (< double > bin0_max) * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) # <<<<<<<<<<<<<< * deltaA = 1.0 / aeraPixel * */ __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max)); /* "splitPixel.pyx":425 * deltaD = (< double > (bin1_min + 1)) - fbin1_min * deltaU = fbin1_max - (< double > bin1_max) * deltaA = 1.0 / aeraPixel # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD */ __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel); /* "splitPixel.pyx":427 * deltaA = 1.0 / aeraPixel * * outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD # <<<<<<<<<<<<<< * outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD * */ __pyx_t_73 = __pyx_v_bin0_min; __pyx_t_74 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_73, __pyx_bstride_0_outCount, __pyx_t_74, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD); /* "splitPixel.pyx":428 * * outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD * outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU */ __pyx_t_79 = __pyx_v_bin0_min; __pyx_t_80 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_79, __pyx_bstride_0_outData, __pyx_t_80, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD); /* "splitPixel.pyx":430 * outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD * * outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU # <<<<<<<<<<<<<< * outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU * */ __pyx_t_81 = __pyx_v_bin0_min; __pyx_t_82 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_81, __pyx_bstride_0_outCount, __pyx_t_82, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU); /* "splitPixel.pyx":431 * * outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU * outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU # <<<<<<<<<<<<<< * * outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD */ __pyx_t_83 = __pyx_v_bin0_min; __pyx_t_84 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_83, __pyx_bstride_0_outData, __pyx_t_84, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU); /* "splitPixel.pyx":433 * outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU * * outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD # <<<<<<<<<<<<<< * outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD * */ __pyx_t_85 = __pyx_v_bin0_max; __pyx_t_86 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_85, __pyx_bstride_0_outCount, __pyx_t_86, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD); /* "splitPixel.pyx":434 * * outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD * outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD # <<<<<<<<<<<<<< * * outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU */ __pyx_t_87 = __pyx_v_bin0_max; __pyx_t_88 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_87, __pyx_bstride_0_outData, __pyx_t_88, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD); /* "splitPixel.pyx":436 * outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD * * outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU # <<<<<<<<<<<<<< * outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): */ __pyx_t_89 = __pyx_v_bin0_max; __pyx_t_90 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_89, __pyx_bstride_0_outCount, __pyx_t_90, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU); /* "splitPixel.pyx":437 * * outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU * outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU # <<<<<<<<<<<<<< * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA * deltaD */ __pyx_t_91 = __pyx_v_bin0_max; __pyx_t_92 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_91, __pyx_bstride_0_outData, __pyx_t_92, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU); /* "splitPixel.pyx":438 * outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU * outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): # <<<<<<<<<<<<<< * outCount[i, bin1_min] += deltaA * deltaD * outData[i, bin1_min] += data * deltaA * deltaD */ __pyx_t_93 = __pyx_v_bin0_max; for (__pyx_t_94 = (__pyx_v_bin0_min + 1); __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) { __pyx_v_i = __pyx_t_94; /* "splitPixel.pyx":439 * outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA * deltaD # <<<<<<<<<<<<<< * outData[i, bin1_min] += data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_95 = __pyx_v_i; __pyx_t_96 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_95, __pyx_bstride_0_outCount, __pyx_t_96, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaD); /* "splitPixel.pyx":440 * for i in range(bin0_min + 1, bin0_max): * outCount[i, bin1_min] += deltaA * deltaD * outData[i, bin1_min] += data * deltaA * deltaD # <<<<<<<<<<<<<< * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += deltaA */ __pyx_t_97 = __pyx_v_i; __pyx_t_98 = __pyx_v_bin1_min; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_97, __pyx_bstride_0_outData, __pyx_t_98, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD); /* "splitPixel.pyx":441 * outCount[i, bin1_min] += deltaA * deltaD * outData[i, bin1_min] += data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[i, j] += deltaA * outData[i, j] += data * deltaA */ __pyx_t_99 = __pyx_v_bin1_max; for (__pyx_t_100 = (__pyx_v_bin1_min + 1); __pyx_t_100 < __pyx_t_99; __pyx_t_100+=1) { __pyx_v_j = __pyx_t_100; /* "splitPixel.pyx":442 * outData[i, bin1_min] += data * deltaA * deltaD * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += deltaA # <<<<<<<<<<<<<< * outData[i, j] += data * deltaA * outCount[i, bin1_max] += deltaA * deltaU */ __pyx_t_101 = __pyx_v_i; __pyx_t_102 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_101, __pyx_bstride_0_outCount, __pyx_t_102, __pyx_bstride_1_outCount) += __pyx_v_deltaA; /* "splitPixel.pyx":443 * for j in range(bin1_min + 1, bin1_max): * outCount[i, j] += deltaA * outData[i, j] += data * deltaA # <<<<<<<<<<<<<< * outCount[i, bin1_max] += deltaA * deltaU * outData[i, bin1_max] += data * deltaA * deltaU */ __pyx_t_103 = __pyx_v_i; __pyx_t_104 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_103, __pyx_bstride_0_outData, __pyx_t_104, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA); } /* "splitPixel.pyx":444 * outCount[i, j] += deltaA * outData[i, j] += data * deltaA * outCount[i, bin1_max] += deltaA * deltaU # <<<<<<<<<<<<<< * outData[i, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): */ __pyx_t_99 = __pyx_v_i; __pyx_t_100 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_99, __pyx_bstride_0_outCount, __pyx_t_100, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaU); /* "splitPixel.pyx":445 * outData[i, j] += data * deltaA * outCount[i, bin1_max] += deltaA * deltaU * outData[i, bin1_max] += data * deltaA * deltaU # <<<<<<<<<<<<<< * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += deltaA * deltaL */ __pyx_t_105 = __pyx_v_i; __pyx_t_106 = __pyx_v_bin1_max; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_105, __pyx_bstride_0_outData, __pyx_t_106, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU); } /* "splitPixel.pyx":446 * outCount[i, bin1_max] += deltaA * deltaU * outData[i, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): # <<<<<<<<<<<<<< * outCount[bin0_min, j] += deltaA * deltaL * outData[bin0_min, j] += data * deltaA * deltaL */ __pyx_t_93 = __pyx_v_bin1_max; for (__pyx_t_94 = (__pyx_v_bin1_min + 1); __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) { __pyx_v_j = __pyx_t_94; /* "splitPixel.pyx":447 * outData[i, bin1_max] += data * deltaA * deltaU * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += deltaA * deltaL # <<<<<<<<<<<<<< * outData[bin0_min, j] += data * deltaA * deltaL * */ __pyx_t_107 = __pyx_v_bin0_min; __pyx_t_108 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_107, __pyx_bstride_0_outCount, __pyx_t_108, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaL); /* "splitPixel.pyx":448 * for j in range(bin1_min + 1, bin1_max): * outCount[bin0_min, j] += deltaA * deltaL * outData[bin0_min, j] += data * deltaA * deltaL # <<<<<<<<<<<<<< * * outCount[bin0_max, j] += deltaA * deltaR */ __pyx_t_109 = __pyx_v_bin0_min; __pyx_t_110 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_109, __pyx_bstride_0_outData, __pyx_t_110, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL); /* "splitPixel.pyx":450 * outData[bin0_min, j] += data * deltaA * deltaL * * outCount[bin0_max, j] += deltaA * deltaR # <<<<<<<<<<<<<< * outData[bin0_max, j] += data * deltaA * deltaR * */ __pyx_t_111 = __pyx_v_bin0_max; __pyx_t_112 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_111, __pyx_bstride_0_outCount, __pyx_t_112, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaR); /* "splitPixel.pyx":451 * * outCount[bin0_max, j] += deltaA * deltaR * outData[bin0_max, j] += data * deltaA * deltaR # <<<<<<<<<<<<<< * * #with nogil: */ __pyx_t_113 = __pyx_v_bin0_max; __pyx_t_114 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_113, __pyx_bstride_0_outData, __pyx_t_114, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR); } } __pyx_L67:; } __pyx_L63:; __pyx_L27_continue:; } /* "splitPixel.pyx":454 * * #with nogil: * for i in range(bins0): # <<<<<<<<<<<<<< * for j in range(bins1): * if outCount[i, j] > epsilon: */ __pyx_t_9 = __pyx_v_bins0; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; /* "splitPixel.pyx":455 * #with nogil: * for i in range(bins0): * for j in range(bins1): # <<<<<<<<<<<<<< * if outCount[i, j] > epsilon: * outMerge[i, j] = outData[i, j] / outCount[i, j] */ __pyx_t_93 = __pyx_v_bins1; for (__pyx_t_94 = 0; __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) { __pyx_v_j = __pyx_t_94; /* "splitPixel.pyx":456 * for i in range(bins0): * for j in range(bins1): * if outCount[i, j] > epsilon: # <<<<<<<<<<<<<< * outMerge[i, j] = outData[i, j] / outCount[i, j] * else: */ __pyx_t_115 = __pyx_v_i; __pyx_t_116 = __pyx_v_j; __pyx_t_19 = ((*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_115, __pyx_bstride_0_outCount, __pyx_t_116, __pyx_bstride_1_outCount)) > __pyx_v_epsilon); if (__pyx_t_19) { /* "splitPixel.pyx":457 * for j in range(bins1): * if outCount[i, j] > epsilon: * outMerge[i, j] = outData[i, j] / outCount[i, j] # <<<<<<<<<<<<<< * else: * outMerge[i, j] = dummy */ __pyx_t_117 = __pyx_v_i; __pyx_t_118 = __pyx_v_j; __pyx_t_119 = __pyx_v_i; __pyx_t_120 = __pyx_v_j; __pyx_t_121 = __pyx_v_i; __pyx_t_122 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_121, __pyx_bstride_0_outMerge, __pyx_t_122, __pyx_bstride_1_outMerge) = ((*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_117, __pyx_bstride_0_outData, __pyx_t_118, __pyx_bstride_1_outData)) / (*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_119, __pyx_bstride_0_outCount, __pyx_t_120, __pyx_bstride_1_outCount))); goto __pyx_L80; } /*else*/ { /* "splitPixel.pyx":459 * outMerge[i, j] = outData[i, j] / outCount[i, j] * else: * outMerge[i, j] = dummy # <<<<<<<<<<<<<< * return outMerge.T, edges0, edges1, outData.T, outCount.T * */ __pyx_t_123 = __pyx_v_i; __pyx_t_124 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_123, __pyx_bstride_0_outMerge, __pyx_t_124, __pyx_bstride_1_outMerge) = __pyx_v_dummy; } __pyx_L80:; } } } /* "splitPixel.pyx":300 * cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1)) * * with nogil: # <<<<<<<<<<<<<< * for i in range(bins0): * edges0[i] = pos0_min + (0.5 +< double > i) * dpos0 */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L22; __pyx_L21: __pyx_why = 4; goto __pyx_L22; __pyx_L22:; Py_BLOCK_THREADS switch (__pyx_why) { case 4: goto __pyx_L1_error; } } } /* "splitPixel.pyx":460 * else: * outMerge[i, j] = dummy * return outMerge.T, edges0, edges1, outData.T, outCount.T # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = PyTuple_New(5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_edges0)); PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0)); __Pyx_INCREF(((PyObject *)__pyx_v_edges1)); PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1)); PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_12); __pyx_t_12 = 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_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_cpos); __Pyx_XDECREF((PyObject *)__pyx_v_cdata); __Pyx_XDECREF((PyObject *)__pyx_v_outData); __Pyx_XDECREF((PyObject *)__pyx_v_outCount); __Pyx_XDECREF((PyObject *)__pyx_v_outMerge); __Pyx_XDECREF((PyObject *)__pyx_v_edges0); __Pyx_XDECREF((PyObject *)__pyx_v_edges1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":190 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":196 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":199 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":200 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":202 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":204 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":205 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L6; } /*else*/ { /* "numpy.pxd":207 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L6:; /* "numpy.pxd":209 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":210 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":213 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":218 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":219 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":222 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":223 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":224 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":225 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); /* "numpy.pxd":226 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } goto __pyx_L9; } /*else*/ { /* "numpy.pxd":228 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":229 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } __pyx_L9:; /* "numpy.pxd":230 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":231 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); /* "numpy.pxd":232 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); /* "numpy.pxd":235 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":236 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; /* "numpy.pxd":240 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":242 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":244 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L12; } /*else*/ { /* "numpy.pxd":247 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L12:; /* "numpy.pxd":249 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":250 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; /* "numpy.pxd":251 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":252 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "numpy.pxd":254 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L15; } /* "numpy.pxd":255 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L15; } /* "numpy.pxd":256 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L15; } /* "numpy.pxd":257 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L15; } /* "numpy.pxd":258 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L15; } /* "numpy.pxd":259 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L15; } /* "numpy.pxd":260 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L15; } /* "numpy.pxd":261 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L15; } /* "numpy.pxd":262 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L15; } /* "numpy.pxd":263 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L15; } /* "numpy.pxd":264 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L15; } /* "numpy.pxd":265 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L15; } /* "numpy.pxd":266 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L15; } /* "numpy.pxd":267 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L15; } /* "numpy.pxd":268 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L15; } /* "numpy.pxd":269 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L15; } /* "numpy.pxd":270 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L15; } /*else*/ { /* "numpy.pxd":272 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_39), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L15:; /* "numpy.pxd":273 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":274 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = '^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":277 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":278 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":281 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":282 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = 0; } __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":284 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); /* "numpy.pxd":285 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { /* "numpy.pxd":286 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":287 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":288 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L6; } __pyx_L6:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":764 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); /* "numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":767 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":770 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":773 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":776 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":779 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); /* "numpy.pxd":786 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":787 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":790 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":791 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":792 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":794 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":797 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; } else { __pyx_t_7 = __pyx_t_6; } if (!__pyx_t_7) { /* "numpy.pxd":798 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { __pyx_t_8 = (!__pyx_v_little_endian); __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":809 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; /* "numpy.pxd":810 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":811 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":812 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } /* "numpy.pxd":814 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_10 = 0; (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); /* "numpy.pxd":816 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { /* "numpy.pxd":817 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":818 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "numpy.pxd":822 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } /* "numpy.pxd":823 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } /* "numpy.pxd":824 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } /* "numpy.pxd":825 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } /* "numpy.pxd":826 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } /* "numpy.pxd":827 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } /* "numpy.pxd":828 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } /* "numpy.pxd":829 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } /* "numpy.pxd":830 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } /* "numpy.pxd":831 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } /* "numpy.pxd":832 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } /* "numpy.pxd":833 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } /* "numpy.pxd":834 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } /* "numpy.pxd":835 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":836 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":837 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /* "numpy.pxd":838 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":840 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_39), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; /* "numpy.pxd":841 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { /* "numpy.pxd":845 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_11; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":846 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":961 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); /* "numpy.pxd":963 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":964 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":966 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":967 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":968 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":969 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); /* "numpy.pxd":972 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":973 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":975 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("splitPixel"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0}, {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0}, {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0}, {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0}, {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0}, {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0}, {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0}, {&__pyx_kp_u_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0, 0}, {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__a0, __pyx_k__a0, sizeof(__pyx_k__a0), 0, 0, 1, 1}, {&__pyx_n_s__a1, __pyx_k__a1, sizeof(__pyx_k__a1), 0, 0, 1, 1}, {&__pyx_n_s__aeraPixel, __pyx_k__aeraPixel, sizeof(__pyx_k__aeraPixel), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, {&__pyx_n_s__b0, __pyx_k__b0, sizeof(__pyx_k__b0), 0, 0, 1, 1}, {&__pyx_n_s__b1, __pyx_k__b1, sizeof(__pyx_k__b1), 0, 0, 1, 1}, {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1}, {&__pyx_n_s__bin0_max, __pyx_k__bin0_max, sizeof(__pyx_k__bin0_max), 0, 0, 1, 1}, {&__pyx_n_s__bin0_min, __pyx_k__bin0_min, sizeof(__pyx_k__bin0_min), 0, 0, 1, 1}, {&__pyx_n_s__bin1_max, __pyx_k__bin1_max, sizeof(__pyx_k__bin1_max), 0, 0, 1, 1}, {&__pyx_n_s__bin1_min, __pyx_k__bin1_min, sizeof(__pyx_k__bin1_min), 0, 0, 1, 1}, {&__pyx_n_s__bins, __pyx_k__bins, sizeof(__pyx_k__bins), 0, 0, 1, 1}, {&__pyx_n_s__bins0, __pyx_k__bins0, sizeof(__pyx_k__bins0), 0, 0, 1, 1}, {&__pyx_n_s__bins1, __pyx_k__bins1, sizeof(__pyx_k__bins1), 0, 0, 1, 1}, {&__pyx_n_s__c0, __pyx_k__c0, sizeof(__pyx_k__c0), 0, 0, 1, 1}, {&__pyx_n_s__c1, __pyx_k__c1, sizeof(__pyx_k__c1), 0, 0, 1, 1}, {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1}, {&__pyx_n_s__cpos, __pyx_k__cpos, sizeof(__pyx_k__cpos), 0, 0, 1, 1}, {&__pyx_n_s__d0, __pyx_k__d0, sizeof(__pyx_k__d0), 0, 0, 1, 1}, {&__pyx_n_s__d1, __pyx_k__d1, sizeof(__pyx_k__d1), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__deltaA, __pyx_k__deltaA, sizeof(__pyx_k__deltaA), 0, 0, 1, 1}, {&__pyx_n_s__deltaD, __pyx_k__deltaD, sizeof(__pyx_k__deltaD), 0, 0, 1, 1}, {&__pyx_n_s__deltaL, __pyx_k__deltaL, sizeof(__pyx_k__deltaL), 0, 0, 1, 1}, {&__pyx_n_s__deltaR, __pyx_k__deltaR, sizeof(__pyx_k__deltaR), 0, 0, 1, 1}, {&__pyx_n_s__deltaU, __pyx_k__deltaU, sizeof(__pyx_k__deltaU), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dpos, __pyx_k__dpos, sizeof(__pyx_k__dpos), 0, 0, 1, 1}, {&__pyx_n_s__dpos0, __pyx_k__dpos0, sizeof(__pyx_k__dpos0), 0, 0, 1, 1}, {&__pyx_n_s__dpos1, __pyx_k__dpos1, sizeof(__pyx_k__dpos1), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__dummy, __pyx_k__dummy, sizeof(__pyx_k__dummy), 0, 0, 1, 1}, {&__pyx_n_s__edges0, __pyx_k__edges0, sizeof(__pyx_k__edges0), 0, 0, 1, 1}, {&__pyx_n_s__edges1, __pyx_k__edges1, sizeof(__pyx_k__edges1), 0, 0, 1, 1}, {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1}, {&__pyx_n_s__epsilon, __pyx_k__epsilon, sizeof(__pyx_k__epsilon), 0, 0, 1, 1}, {&__pyx_n_s__fbin0_max, __pyx_k__fbin0_max, sizeof(__pyx_k__fbin0_max), 0, 0, 1, 1}, {&__pyx_n_s__fbin0_min, __pyx_k__fbin0_min, sizeof(__pyx_k__fbin0_min), 0, 0, 1, 1}, {&__pyx_n_s__fbin1_max, __pyx_k__fbin1_max, sizeof(__pyx_k__fbin1_max), 0, 0, 1, 1}, {&__pyx_n_s__fbin1_min, __pyx_k__fbin1_min, sizeof(__pyx_k__fbin1_min), 0, 0, 1, 1}, {&__pyx_n_s__finfo, __pyx_k__finfo, sizeof(__pyx_k__finfo), 0, 0, 1, 1}, {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, {&__pyx_n_s__fullSplit1D, __pyx_k__fullSplit1D, sizeof(__pyx_k__fullSplit1D), 0, 0, 1, 1}, {&__pyx_n_s__fullSplit2D, __pyx_k__fullSplit2D, sizeof(__pyx_k__fullSplit2D), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, {&__pyx_n_s__max0, __pyx_k__max0, sizeof(__pyx_k__max0), 0, 0, 1, 1}, {&__pyx_n_s__max1, __pyx_k__max1, sizeof(__pyx_k__max1), 0, 0, 1, 1}, {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, {&__pyx_n_s__min0, __pyx_k__min0, sizeof(__pyx_k__min0), 0, 0, 1, 1}, {&__pyx_n_s__min1, __pyx_k__min1, sizeof(__pyx_k__min1), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__outCount, __pyx_k__outCount, sizeof(__pyx_k__outCount), 0, 0, 1, 1}, {&__pyx_n_s__outData, __pyx_k__outData, sizeof(__pyx_k__outData), 0, 0, 1, 1}, {&__pyx_n_s__outMerge, __pyx_k__outMerge, sizeof(__pyx_k__outMerge), 0, 0, 1, 1}, {&__pyx_n_s__outPos, __pyx_k__outPos, sizeof(__pyx_k__outPos), 0, 0, 1, 1}, {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, {&__pyx_n_s__pos0Range, __pyx_k__pos0Range, sizeof(__pyx_k__pos0Range), 0, 0, 1, 1}, {&__pyx_n_s__pos0_max, __pyx_k__pos0_max, sizeof(__pyx_k__pos0_max), 0, 0, 1, 1}, {&__pyx_n_s__pos0_maxin, __pyx_k__pos0_maxin, sizeof(__pyx_k__pos0_maxin), 0, 0, 1, 1}, {&__pyx_n_s__pos0_min, __pyx_k__pos0_min, sizeof(__pyx_k__pos0_min), 0, 0, 1, 1}, {&__pyx_n_s__pos1Range, __pyx_k__pos1Range, sizeof(__pyx_k__pos1Range), 0, 0, 1, 1}, {&__pyx_n_s__pos1_max, __pyx_k__pos1_max, sizeof(__pyx_k__pos1_max), 0, 0, 1, 1}, {&__pyx_n_s__pos1_maxin, __pyx_k__pos1_maxin, sizeof(__pyx_k__pos1_maxin), 0, 0, 1, 1}, {&__pyx_n_s__pos1_min, __pyx_k__pos1_min, sizeof(__pyx_k__pos1_min), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__ravel, __pyx_k__ravel, sizeof(__pyx_k__ravel), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__splitPixel, __pyx_k__splitPixel, sizeof(__pyx_k__splitPixel), 0, 0, 1, 1}, {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "splitPixel.pyx":141 * assert bins > 1 * cdef long size = weights.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") */ __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); /* "splitPixel.pyx":142 * cdef long size = weights.size * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64") */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "splitPixel.pyx":153 * pos0_maxin = max(pos0Range) * else: * pos0_min = pos[:, :, 0].min() # <<<<<<<<<<<<<< * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); __pyx_k_tuple_5 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_INCREF(__pyx_k_slice_3); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_5, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); /* "splitPixel.pyx":154 * else: * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * if pos1Range is not None and len(pos1Range) > 1: */ __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_6); __Pyx_GIVEREF(__pyx_k_slice_6); __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 = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_7); __Pyx_GIVEREF(__pyx_k_slice_7); __pyx_k_tuple_8 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(__pyx_k_slice_6); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_k_slice_6); __Pyx_GIVEREF(__pyx_k_slice_6); __Pyx_INCREF(__pyx_k_slice_7); PyTuple_SET_ITEM(__pyx_k_tuple_8, 1, __pyx_k_slice_7); __Pyx_GIVEREF(__pyx_k_slice_7); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_8, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "splitPixel.pyx":160 * pos1_maxin = max(pos1Range) * else: * pos1_min = pos[:, :, 1].min() # <<<<<<<<<<<<<< * pos1_max = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) */ __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); __pyx_k_tuple_11 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); __Pyx_INCREF(__pyx_k_slice_9); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); __Pyx_INCREF(__pyx_k_slice_10); PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, __pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_11, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "splitPixel.pyx":161 * else: * pos1_min = pos[:, :, 1].min() * pos1_max = pos[:, :, 1].max() # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * cdef double dpos = (pos0_max - pos0_min) / (< double > (bins)) */ __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_12); __Pyx_GIVEREF(__pyx_k_slice_12); __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); __pyx_k_tuple_14 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_INCREF(__pyx_k_slice_12); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, __pyx_k_slice_12); __Pyx_GIVEREF(__pyx_k_slice_12); __Pyx_INCREF(__pyx_k_slice_13); PyTuple_SET_ITEM(__pyx_k_tuple_14, 1, __pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_14, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "splitPixel.pyx":265 * * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); /* "splitPixel.pyx":266 * * cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel() # <<<<<<<<<<<<<< * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64") * cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64") */ __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "splitPixel.pyx":285 * pos0_maxin = max(pos0Range) * else: * pos0_min = pos[:, :, 0].min() # <<<<<<<<<<<<<< * pos0_maxin = pos[:, :, 0].max() * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) */ __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 = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_18); __Pyx_GIVEREF(__pyx_k_slice_18); __pyx_k_tuple_19 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); __Pyx_INCREF(__pyx_k_slice_17); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); __Pyx_INCREF(__pyx_k_slice_18); PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, __pyx_k_slice_18); __Pyx_GIVEREF(__pyx_k_slice_18); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); /* "splitPixel.pyx":286 * else: * pos0_min = pos[:, :, 0].min() * pos0_maxin = pos[:, :, 0].max() # <<<<<<<<<<<<<< * pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps) * */ __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_21); __Pyx_GIVEREF(__pyx_k_slice_21); __pyx_k_tuple_22 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); __Pyx_INCREF(__pyx_k_slice_20); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, __pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); __Pyx_INCREF(__pyx_k_slice_21); PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, __pyx_k_slice_21); __Pyx_GIVEREF(__pyx_k_slice_21); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); /* "splitPixel.pyx":293 * pos1_maxin = max(pos1Range) * else: * pos1_min = pos[:, :, 1].min() # <<<<<<<<<<<<<< * pos1_maxin = pos[:, :, 1].max() * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) */ __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 = 293; __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 = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_24); __Pyx_GIVEREF(__pyx_k_slice_24); __pyx_k_tuple_25 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); __Pyx_INCREF(__pyx_k_slice_23); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_k_slice_23); __Pyx_GIVEREF(__pyx_k_slice_23); __Pyx_INCREF(__pyx_k_slice_24); PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, __pyx_k_slice_24); __Pyx_GIVEREF(__pyx_k_slice_24); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); /* "splitPixel.pyx":294 * else: * pos1_min = pos[:, :, 1].min() * pos1_maxin = pos[:, :, 1].max() # <<<<<<<<<<<<<< * pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps) * */ __pyx_k_slice_26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __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(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_27); __Pyx_GIVEREF(__pyx_k_slice_27); __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_33)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_u_33)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_33)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_35)); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_u_35)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_35)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_37)); PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_u_37)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_37)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_40)); PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_u_40)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_40)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_37)); PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_u_37)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_37)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44)); __Pyx_INCREF(((PyObject *)__pyx_kp_u_43)); PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_u_43)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_43)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44)); /* "splitPixel.pyx":113 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit1D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * long bins=100, */ __pyx_k_tuple_45 = PyTuple_New(39); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 1, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 2, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 3, ((PyObject *)__pyx_n_s__pos0Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 4, ((PyObject *)__pyx_n_s__pos1Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 5, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 6, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 7, ((PyObject *)__pyx_n_s__cpos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 8, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 9, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 10, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 11, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 12, ((PyObject *)__pyx_n_s__outPos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 13, ((PyObject *)__pyx_n_s__min0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 14, ((PyObject *)__pyx_n_s__max0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 15, ((PyObject *)__pyx_n_s__deltaR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 16, ((PyObject *)__pyx_n_s__deltaL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 17, ((PyObject *)__pyx_n_s__deltaA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 18, ((PyObject *)__pyx_n_s__pos0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 19, ((PyObject *)__pyx_n_s__pos0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 20, ((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 21, ((PyObject *)__pyx_n_s__pos1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 22, ((PyObject *)__pyx_n_s__pos1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 23, ((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 24, ((PyObject *)__pyx_n_s__dpos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 25, ((PyObject *)__pyx_n_s__bin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 26, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 27, ((PyObject *)__pyx_n_s__idx)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 28, ((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 29, ((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 30, ((PyObject *)__pyx_n_s__bin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 31, ((PyObject *)__pyx_n_s__bin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 32, ((PyObject *)__pyx_n_s__aeraPixel)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel)); __Pyx_INCREF(((PyObject *)__pyx_n_s__a0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 33, ((PyObject *)__pyx_n_s__a0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__b0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 34, ((PyObject *)__pyx_n_s__b0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__c0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 35, ((PyObject *)__pyx_n_s__c0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__d0)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 36, ((PyObject *)__pyx_n_s__d0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 37, ((PyObject *)__pyx_n_s__epsilon)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 38, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); __pyx_k_codeobj_46 = (PyObject*)__Pyx_PyCode_New(6, 0, 39, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_47, __pyx_n_s__fullSplit1D, 113, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "splitPixel.pyx":229 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit2D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * bins not None, */ __pyx_k_tuple_48 = PyTuple_New(55); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 1, ((PyObject *)__pyx_n_s__weights)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 2, ((PyObject *)__pyx_n_s__bins)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 3, ((PyObject *)__pyx_n_s__pos0Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 4, ((PyObject *)__pyx_n_s__pos1Range)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 5, ((PyObject *)__pyx_n_s__dummy)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 6, ((PyObject *)__pyx_n_s__bins0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 7, ((PyObject *)__pyx_n_s__bins1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 8, ((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_48, 9, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 10, ((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_48, 11, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 12, ((PyObject *)__pyx_n_s__cpos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 13, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outData)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 14, ((PyObject *)__pyx_n_s__outData)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 15, ((PyObject *)__pyx_n_s__outCount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 16, ((PyObject *)__pyx_n_s__outMerge)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 17, ((PyObject *)__pyx_n_s__edges0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 18, ((PyObject *)__pyx_n_s__edges1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 19, ((PyObject *)__pyx_n_s__min0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 20, ((PyObject *)__pyx_n_s__max0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__min1)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 21, ((PyObject *)__pyx_n_s__min1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__max1)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 22, ((PyObject *)__pyx_n_s__max1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 23, ((PyObject *)__pyx_n_s__deltaR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 24, ((PyObject *)__pyx_n_s__deltaL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 25, ((PyObject *)__pyx_n_s__deltaU)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 26, ((PyObject *)__pyx_n_s__deltaD)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD)); __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 27, ((PyObject *)__pyx_n_s__deltaA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 28, ((PyObject *)__pyx_n_s__pos0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 29, ((PyObject *)__pyx_n_s__pos0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 30, ((PyObject *)__pyx_n_s__pos1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 31, ((PyObject *)__pyx_n_s__pos1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 32, ((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 33, ((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 34, ((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 35, ((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 36, ((PyObject *)__pyx_n_s__fbin1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 37, ((PyObject *)__pyx_n_s__fbin1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 38, ((PyObject *)__pyx_n_s__bin0_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 39, ((PyObject *)__pyx_n_s__bin0_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 40, ((PyObject *)__pyx_n_s__bin1_max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 41, ((PyObject *)__pyx_n_s__bin1_min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 42, ((PyObject *)__pyx_n_s__aeraPixel)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel)); __Pyx_INCREF(((PyObject *)__pyx_n_s__a0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 43, ((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_48, 44, ((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_48, 45, ((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_48, 46, ((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_48, 47, ((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_48, 48, ((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_48, 49, ((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_48, 50, ((PyObject *)__pyx_n_s__d1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 51, ((PyObject *)__pyx_n_s__epsilon)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 52, ((PyObject *)__pyx_n_s__dpos0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 53, ((PyObject *)__pyx_n_s__dpos1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 54, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); __pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(6, 0, 55, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_47, __pyx_n_s__fullSplit2D, 229, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initsplitPixel(void); /*proto*/ PyMODINIT_FUNC initsplitPixel(void) #else PyMODINIT_FUNC PyInit_splitPixel(void); /*proto*/ PyMODINIT_FUNC PyInit_splitPixel(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_splitPixel(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("splitPixel"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_splitPixel) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "splitPixel.pyx":30 * import cython * cimport numpy * import numpy # <<<<<<<<<<<<<< * * cdef extern from "math.h": */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitPixel.pyx":113 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit1D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * long bins=100, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_fullSplit1D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit1D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitPixel.pyx":229 * @cython.boundscheck(False) * @cython.wraparound(False) * def fullSplit2D(numpy.ndarray pos not None, # <<<<<<<<<<<<<< * numpy.ndarray weights not None, * bins not None, */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_1fullSplit2D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit2D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "splitPixel.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # -*- coding: utf8 -*- * # */ __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; /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init splitPixel", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init splitPixel"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; int is_complex; char enc_type; char new_packmode; char enc_packmode; } __Pyx_BufFmt_Context; static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'b': return "'char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset; if (ctx->enc_type == 0) return 0; group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } __Pyx_BufFmt_RaiseExpected(ctx); return -1; } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; --ctx->enc_count; /* Consume from buffer string */ /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; } break; case '}': /* end of substruct; either repeat or move on */ ++ts; return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; default: { int number = __Pyx_BufFmt_ParseNumber(&ts); if (number == -1) { /* First char was not a digit */ PyErr_Format(PyExc_ValueError, "Does not understand character buffer dtype format string ('%c')", *ts); return NULL; } ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; PyErr_NormalizeException(&local_type, &local_value, &local_tb); if (unlikely(tstate->curexc_type)) goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif *type = local_type; *value = local_value; *tb = local_tb; Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); else { PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject* obj = view->obj; if (obj) { #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); Py_DECREF(obj); view->obj = NULL; } } #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(Py_intptr_t) == sizeof(char)) || (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(Py_intptr_t) == sizeof(int)) || (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } #if PY_MAJOR_VERSION < 3 static PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject((char *)"stdout"); if (!f) { PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); } return f; } static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { PyObject* v; int i; if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) return -1; } v = PyTuple_GET_ITEM(arg_tuple, i); if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) return -1; if (PyString_Check(v)) { char *s = PyString_AsString(v); Py_ssize_t len = PyString_Size(v); if (len > 0 && isspace(Py_CHARMASK(s[len-1])) && s[len-1] != ' ') PyFile_SoftSpace(f, 0); } } if (newline) { if (PyFile_WriteString("\n", f) < 0) return -1; PyFile_SoftSpace(f, 0); } return 0; } #else /* Python 3 has a print function */ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; PyObject* end_string; if (unlikely(!__pyx_print)) { __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); if (!__pyx_print) return -1; } if (stream) { kwargs = PyDict_New(); if (unlikely(!kwargs)) return -1; if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) goto bad; if (!newline) { end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) goto bad; if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { Py_DECREF(end_string); goto bad; } Py_DECREF(end_string); } } else if (!newline) { if (unlikely(!__pyx_print_kwargs)) { __pyx_print_kwargs = PyDict_New(); if (unlikely(!__pyx_print_kwargs)) return -1; end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) return -1; if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { Py_DECREF(end_string); return -1; } Py_DECREF(end_string); } kwargs = __pyx_print_kwargs; } result = PyObject_Call(__pyx_print, arg_tuple, kwargs); if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) Py_DECREF(kwargs); if (!result) return -1; Py_DECREF(result); return 0; bad: if (kwargs != __pyx_print_kwargs) Py_XDECREF(kwargs); return -1; } #endif #if PY_MAJOR_VERSION < 3 static int __Pyx_PrintOne(PyObject* f, PyObject *o) { if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } if (PyFile_SoftSpace(f, 0)) { if (PyFile_WriteString(" ", f) < 0) return -1; } if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) return -1; if (PyFile_WriteString("\n", f) < 0) return -1; return 0; /* the line below is just to avoid compiler * compiler warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } #else /* Python 3 has a print function */ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; PyObject* arg_tuple = PyTuple_New(1); if (unlikely(!arg_tuple)) return -1; Py_INCREF(o); PyTuple_SET_ITEM(arg_tuple, 0, o); res = __Pyx_Print(stream, arg_tuple, 1); Py_DECREF(arg_tuple); return res; } #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pyfai-0.3.5/src/splitPixel.html0000644001611600065110000161402211656053756015637 0ustar kieffersoft

Generated by Cython 0.15.1+ on Mon Nov 7 23:13:01 2011

Raw output: splitPixel.c

 1: #!/usr/bin/env python
  /* "splitPixel.pyx":1
 * #!/usr/bin/env python             # <<<<<<<<<<<<<<
 * # -*- coding: utf8 -*-
 * #
 */
  __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: utf8 -*-
 3: #
 4: #    Project: Azimuthal integration
 5: #             https://forge.epn-campus.eu/projects/azimuthal
 6: #
 7: #    File: "$Id$"
 8: #
 9: #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
 10: #
 11: #    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
 12: #
 13: #    This program is free software: you can redistribute it and/or modify
 14: #    it under the terms of the GNU General Public License as published by
 15: #    the Free Software Foundation, either version 3 of the License, or
 16: #    (at your option) any later version.
 17: #
 18: #    This program is distributed in the hope that it will be useful,
 19: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21: #    GNU General Public License for more details.
 22: #
 23: #    You should have received a copy of the GNU General Public License
 24: #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 25: #
 26: 
 27: 
 28: import cython
 29: cimport numpy
 30: import numpy
  /* "splitPixel.pyx":30
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h":
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 31: 
 32: cdef extern from "math.h":
 33:     double floor(double)nogil
 34:     double  fabs(double)nogil
 35: 
 36: 
 37: cdef extern from "stdlib.h":
 38:     void free(void * ptr)nogil
 39:     void * calloc(size_t nmemb, size_t size)nogil
 40:     void * malloc(size_t size)nogil
 41: 
 42: ctypedef numpy.int64_t DTYPE_int64_t
/* "splitPixel.pyx":42
 *     void * malloc(size_t size)nogil
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_10splitPixel_DTYPE_int64_t;
 43: ctypedef numpy.float64_t DTYPE_float64_t
 44: 
 45: cdef double areaTriangle(double a0,
/* "splitPixel.pyx":45
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 * cdef double areaTriangle(double a0,             # <<<<<<<<<<<<<<
 *                          double a1,
 *                          double b0,
 */

static double __pyx_f_10splitPixel_areaTriangle(double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_b0, double __pyx_v_b1, double __pyx_v_c0, double __pyx_v_c1) {
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("areaTriangle");
 46:                          double a1,
 47:                          double b0,
 48:                          double b1,
 49:                          double c0,
 50:                          double c1):
 51:     """
 52:     Calculate the area of the ABC triangle with corners:
 53:     A(a0,a1)
 54:     B(b0,b1)
 55:     C(c0,c1)
 56:     @return: area, i.e. 1/2 * (B-A)^(C-A)
 57:     """
 58:     return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0)))
  /* "splitPixel.pyx":58
 *     @return: area, i.e. 1/2 * (B-A)^(C-A)
 *     """
 *     return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0)))             # <<<<<<<<<<<<<<
 * 
 * cdef double areaQuad(double a0,
 */
  __pyx_r = (0.5 * fabs((((__pyx_v_b0 - __pyx_v_a0) * (__pyx_v_c1 - __pyx_v_a1)) - ((__pyx_v_b1 - __pyx_v_a1) * (__pyx_v_c0 - __pyx_v_a0)))));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 59: 
 60: cdef double areaQuad(double a0,
/* "splitPixel.pyx":60
 *     return 0.5 * abs(((b0 - a0) * (c1 - a1)) - ((b1 - a1) * (c0 - a0)))
 * 
 * cdef double areaQuad(double a0,             # <<<<<<<<<<<<<<
 *                      double a1,
 *                      double b0,
 */

static double __pyx_f_10splitPixel_areaQuad(double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_b0, double __pyx_v_b1, double __pyx_v_c0, double __pyx_v_c1, double __pyx_v_d0, double __pyx_v_d1) {
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("areaQuad");
 61:                      double a1,
 62:                      double b0,
 63:                      double b1,
 64:                      double c0,
 65:                      double c1,
 66:                      double d0,
 67:                      double d1
 68:                      ):
 69:     """
 70:     Calculate the area of the ABCD quadrilataire  with corners:
 71:     A(a0,a1)
 72:     B(b0,b1)
 73:     C(c0,c1)
 74:     D(d0,d1)
 75:     @return: area, i.e. 1/2 * (AC ^ BD)
 76:     """
 77:     return 0.5 * abs(((c0 - a0) * (d1 - b1)) - ((c1 - a1) * (d0 - b0)))
  /* "splitPixel.pyx":77
 *     @return: area, i.e. 1/2 * (AC ^ BD)
 *     """
 *     return 0.5 * abs(((c0 - a0) * (d1 - b1)) - ((c1 - a1) * (d0 - b0)))             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  __pyx_r = (0.5 * fabs((((__pyx_v_c0 - __pyx_v_a0) * (__pyx_v_d1 - __pyx_v_b1)) - ((__pyx_v_c1 - __pyx_v_a1) * (__pyx_v_d0 - __pyx_v_b0)))));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 78: 
 79: @cython.cdivision(True)
 80: cdef double  getBinNr(double x0, double pos0_min, double dpos) nogil:
/* "splitPixel.pyx":80
 * 
 * @cython.cdivision(True)
 * cdef double  getBinNr(double x0, double pos0_min, double dpos) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     calculate the bin number for any point
 */

static double __pyx_f_10splitPixel_getBinNr(double __pyx_v_x0, double __pyx_v_pos0_min, double __pyx_v_dpos) {
  double __pyx_r;
 81:     """
 82:     calculate the bin number for any point
 83:     param x0: current position
 84:     param pos0_min: position minimum
 85:     param dpos: bin width
 86:     """
 87:     return (x0 - pos0_min) / dpos
  /* "splitPixel.pyx":87
 *     param dpos: bin width
 *     """
 *     return (x0 - pos0_min) / dpos             # <<<<<<<<<<<<<<
 * 
 * cdef double min4f(double a, double b, double c, double d) nogil:
 */
  __pyx_r = ((__pyx_v_x0 - __pyx_v_pos0_min) / __pyx_v_dpos);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}
 88: 
 89: cdef double min4f(double a, double b, double c, double d) nogil:
/* "splitPixel.pyx":89
 *     return (x0 - pos0_min) / dpos
 * 
 * cdef double min4f(double a, double b, double c, double d) nogil:             # <<<<<<<<<<<<<<
 *     if (a <= b) and (a <= c) and (a <= d):
 *         return a
 */

static double __pyx_f_10splitPixel_min4f(double __pyx_v_a, double __pyx_v_b, double __pyx_v_c, double __pyx_v_d) {
  double __pyx_r;
 90:     if (a <= b) and (a <= c) and (a <= d):
  /* "splitPixel.pyx":90
 * 
 * cdef double min4f(double a, double b, double c, double d) nogil:
 *     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) {
 91:         return a
    /* "splitPixel.pyx":91
 * cdef double min4f(double a, double b, double c, double d) nogil:
 *     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:;
 92:     if (b <= a) and (b <= c) and (b <= d):
  /* "splitPixel.pyx":92
 *     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) {
 93:         return b
    /* "splitPixel.pyx":93
 *         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:;
 94:     if (c <= a) and (c <= b) and (c <= d):
  /* "splitPixel.pyx":94
 *     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) {
 95:         return c
    /* "splitPixel.pyx":95
 *         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*/ {
 96:     else:
 97:         return d
    /* "splitPixel.pyx":97
 *         return c
 *     else:
 *         return d             # <<<<<<<<<<<<<<
 * 
 * cdef double max4f(double a, double b, double c, double d) nogil:
 */
    __pyx_r = __pyx_v_d;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}
 98: 
 99: cdef double max4f(double a, double b, double c, double d) nogil:
/* "splitPixel.pyx":99
 *         return d
 * 
 * cdef double max4f(double a, double b, double c, double d) nogil:             # <<<<<<<<<<<<<<
 *     """Calculates the max of 4 double numbers"""
 *     if (a >= b) and (a >= c) and (a >= d):
 */

static double __pyx_f_10splitPixel_max4f(double __pyx_v_a, double __pyx_v_b, double __pyx_v_c, double __pyx_v_d) {
  double __pyx_r;
 100:     """Calculates the max of 4 double numbers"""
 101:     if (a >= b) and (a >= c) and (a >= d):
  /* "splitPixel.pyx":101
 * cdef double max4f(double a, double b, double c, double d) nogil:
 *     """Calculates the max of 4 double 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) {
 102:         return a
    /* "splitPixel.pyx":102
 *     """Calculates the max of 4 double 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:;
 103:     if (b >= a) and (b >= c) and (b >= d):
  /* "splitPixel.pyx":103
 *     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) {
 104:         return b
    /* "splitPixel.pyx":104
 *         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:;
 105:     if (c >= a) and (c >= b) and (c >= d):
  /* "splitPixel.pyx":105
 *     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) {
 106:         return c
    /* "splitPixel.pyx":106
 *         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*/ {
 107:     else:
 108:         return d
    /* "splitPixel.pyx":108
 *         return c
 *     else:
 *         return d             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
    __pyx_r = __pyx_v_d;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}
 109: 
 110: @cython.cdivision(True)
 111: @cython.boundscheck(False)
 112: @cython.wraparound(False)
 113: def fullSplit1D(numpy.ndarray pos not None,
/* "splitPixel.pyx":113
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit1D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None,
 *               long bins=100,
 */

static PyObject *__pyx_pf_10splitPixel_fullSplit1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10splitPixel_fullSplit1D[] = "\n    Calculates histogram of pos weighted by weights\n    \n    Splitting is done on the pixel's bounding box like fit2D\n    \n    \n    @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi\n    @param weights: array with intensities\n    @param bins: number of output bins\n    @param pos0Range: minimum and maximum  of the 2th range\n    @param pos1Range: minimum and maximum  of the chi range\n    @param dummy: value for bins without pixels \n    @return 2theta, I, weighted histogram, unweighted histogram\n    ";
static PyMethodDef __pyx_mdef_10splitPixel_fullSplit1D = {__Pyx_NAMESTR("fullSplit1D"), (PyCFunction)__pyx_pf_10splitPixel_fullSplit1D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10splitPixel_fullSplit1D)};
static PyObject *__pyx_pf_10splitPixel_fullSplit1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pos = 0;
  PyArrayObject *__pyx_v_weights = 0;
  long __pyx_v_bins;
  PyObject *__pyx_v_pos0Range = 0;
  PyObject *__pyx_v_pos1Range = 0;
  double __pyx_v_dummy;
  long __pyx_v_size;
  PyArrayObject *__pyx_v_cpos = 0;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_outPos = 0;
  double __pyx_v_min0;
  double __pyx_v_max0;
  double __pyx_v_deltaR;
  double __pyx_v_deltaL;
  double __pyx_v_deltaA;
  double __pyx_v_pos0_min;
  double __pyx_v_pos0_max;
  double __pyx_v_pos0_maxin;
  CYTHON_UNUSED double __pyx_v_pos1_min;
  CYTHON_UNUSED double __pyx_v_pos1_max;
  double __pyx_v_pos1_maxin;
  double __pyx_v_dpos;
  CYTHON_UNUSED long __pyx_v_bin;
  long __pyx_v_i;
  long __pyx_v_idx;
  double __pyx_v_fbin0_min;
  double __pyx_v_fbin0_max;
  long __pyx_v_bin0_max;
  long __pyx_v_bin0_min;
  double __pyx_v_aeraPixel;
  double __pyx_v_a0;
  double __pyx_v_b0;
  double __pyx_v_c0;
  double __pyx_v_d0;
  double __pyx_v_epsilon;
  double __pyx_v_data;
  Py_buffer __pyx_bstruct_outPos;
  Py_ssize_t __pyx_bstride_0_outPos = 0;
  Py_ssize_t __pyx_bshape_0_outPos = 0;
  Py_buffer __pyx_bstruct_outMerge;
  Py_ssize_t __pyx_bstride_0_outMerge = 0;
  Py_ssize_t __pyx_bshape_0_outMerge = 0;
  Py_buffer __pyx_bstruct_outCount;
  Py_ssize_t __pyx_bstride_0_outCount = 0;
  Py_ssize_t __pyx_bshape_0_outCount = 0;
  Py_buffer __pyx_bstruct_cdata;
  Py_ssize_t __pyx_bstride_0_cdata = 0;
  Py_ssize_t __pyx_bshape_0_cdata = 0;
  Py_buffer __pyx_bstruct_cpos;
  Py_ssize_t __pyx_bstride_0_cpos = 0;
  Py_ssize_t __pyx_bstride_1_cpos = 0;
  Py_ssize_t __pyx_bstride_2_cpos = 0;
  Py_ssize_t __pyx_bshape_0_cpos = 0;
  Py_ssize_t __pyx_bshape_1_cpos = 0;
  Py_ssize_t __pyx_bshape_2_cpos = 0;
  Py_buffer __pyx_bstruct_outData;
  Py_ssize_t __pyx_bstride_0_outData = 0;
  Py_ssize_t __pyx_bshape_0_outData = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fullSplit1D");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};

  /* "splitPixel.pyx":113
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit1D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None,
 *               long bins=100,
 */
  __pyx_k_tuple_45 = PyTuple_New(39); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_n_s__pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 1, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 2, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 3, ((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 4, ((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 5, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 6, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 7, ((PyObject *)__pyx_n_s__cpos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 8, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 9, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 10, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 11, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 12, ((PyObject *)__pyx_n_s__outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 13, ((PyObject *)__pyx_n_s__min0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 14, ((PyObject *)__pyx_n_s__max0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 15, ((PyObject *)__pyx_n_s__deltaR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 16, ((PyObject *)__pyx_n_s__deltaL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 17, ((PyObject *)__pyx_n_s__deltaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 18, ((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 19, ((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 20, ((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 21, ((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 22, ((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 23, ((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 24, ((PyObject *)__pyx_n_s__dpos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 25, ((PyObject *)__pyx_n_s__bin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 26, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 27, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 28, ((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 29, ((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 30, ((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 31, ((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 32, ((PyObject *)__pyx_n_s__aeraPixel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 33, ((PyObject *)__pyx_n_s__a0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 34, ((PyObject *)__pyx_n_s__b0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__c0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 35, ((PyObject *)__pyx_n_s__c0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__d0));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 36, ((PyObject *)__pyx_n_s__d0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 37, ((PyObject *)__pyx_n_s__epsilon));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 38, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));

  /* "splitPixel.pyx":113
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit1D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *               numpy.ndarray weights not None,
 *               long bins=100,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_fullSplit1D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit1D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_codeobj_46 = (PyObject*)__Pyx_PyCode_New(6, 0, 39, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_47, __pyx_n_s__fullSplit1D, 113, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 114:               numpy.ndarray weights not None,
 115:               long bins=100,
 116:               pos0Range=None,
    /* "splitPixel.pyx":116
 *               numpy.ndarray weights not None,
 *               long bins=100,
 *               pos0Range=None,             # <<<<<<<<<<<<<<
 *               pos1Range=None,
 *               double dummy=0.0
 */
    values[3] = ((PyObject *)Py_None);
 117:               pos1Range=None,
    /* "splitPixel.pyx":117
 *               long bins=100,
 *               pos0Range=None,
 *               pos1Range=None,             # <<<<<<<<<<<<<<
 *               double dummy=0.0
 *               ):
 */
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fullSplit1D", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fullSplit1D") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pos = ((PyArrayObject *)values[0]);
    __pyx_v_weights = ((PyArrayObject *)values[1]);
    if (values[2]) {
      __pyx_v_bins = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_bins == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_bins = ((long)100);
    }
    __pyx_v_pos0Range = values[3];
    __pyx_v_pos1Range = values[4];
    if (values[5]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
 118:               double dummy=0.0
      /* "splitPixel.pyx":118
 *               pos0Range=None,
 *               pos1Range=None,
 *               double dummy=0.0             # <<<<<<<<<<<<<<
 *               ):
 *     """
 */
      __pyx_v_dummy = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fullSplit1D", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("splitPixel.fullSplit1D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_cpos.buf = NULL;
  __pyx_bstruct_cdata.buf = NULL;
  __pyx_bstruct_outData.buf = NULL;
  __pyx_bstruct_outCount.buf = NULL;
  __pyx_bstruct_outMerge.buf = NULL;
  __pyx_bstruct_outPos.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 119:               ):
 120:     """
 121:     Calculates histogram of pos weighted by weights
 122: 
 123:     Splitting is done on the pixel's bounding box like fit2D
 124: 
 125: 
 126:     @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi
 127:     @param weights: array with intensities
 128:     @param bins: number of output bins
 129:     @param pos0Range: minimum and maximum  of the 2th range
 130:     @param pos1Range: minimum and maximum  of the chi range
 131:     @param dummy: value for bins without pixels
 132:     @return 2theta, I, weighted histogram, unweighted histogram
 133:     """
 134: 
 135:     assert pos.shape[0] == weights.size
  /* "splitPixel.pyx":135
 *     """
 * 
 *     assert pos.shape[0] == weights.size             # <<<<<<<<<<<<<<
 *     assert pos.shape[1] == 4
 *     assert pos.shape[2] == 2
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 136:     assert pos.shape[1] == 4
  /* "splitPixel.pyx":136
 * 
 *     assert pos.shape[0] == weights.size
 *     assert pos.shape[1] == 4             # <<<<<<<<<<<<<<
 *     assert pos.shape[2] == 2
 *     assert pos.ndim == 3
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 137:     assert pos.shape[2] == 2
  /* "splitPixel.pyx":137
 *     assert pos.shape[0] == weights.size
 *     assert pos.shape[1] == 4
 *     assert pos.shape[2] == 2             # <<<<<<<<<<<<<<
 *     assert pos.ndim == 3
 *     assert  bins > 1
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 138:     assert pos.ndim == 3
  /* "splitPixel.pyx":138
 *     assert pos.shape[1] == 4
 *     assert pos.shape[2] == 2
 *     assert pos.ndim == 3             # <<<<<<<<<<<<<<
 *     assert  bins > 1
 *     cdef long  size = weights.size
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_pos->nd == 3))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 139:     assert  bins > 1
  /* "splitPixel.pyx":139
 *     assert pos.shape[2] == 2
 *     assert pos.ndim == 3
 *     assert  bins > 1             # <<<<<<<<<<<<<<
 *     cdef long  size = weights.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_bins > 1))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 140:     cdef long  size = weights.size
  /* "splitPixel.pyx":140
 *     assert pos.ndim == 3
 *     assert  bins > 1
 *     cdef long  size = weights.size             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_size = __pyx_t_5;
 141:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
  /* "splitPixel.pyx":141
 *     assert  bins > 1
 *     cdef long  size = weights.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0]; __pyx_bstride_1_cpos = __pyx_bstruct_cpos.strides[1]; __pyx_bstride_2_cpos = __pyx_bstruct_cpos.strides[2];
      __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0]; __pyx_bshape_1_cpos = __pyx_bstruct_cpos.shape[1]; __pyx_bshape_2_cpos = __pyx_bstruct_cpos.shape[2];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_cpos = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "splitPixel.pyx":141
 *     assert  bins > 1
 *     cdef long  size = weights.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 142:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
  /* "splitPixel.pyx":142
 *     cdef long  size = weights.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0];
      __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "splitPixel.pyx":142
 *     cdef long  size = weights.size
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 143:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
  /* "splitPixel.pyx":143
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0];
      __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
 144:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
  /* "splitPixel.pyx":144
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0];
      __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 145:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
  /* "splitPixel.pyx":145
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
 *     cdef double min0, max0, deltaR, deltaL, deltaA
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0];
      __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 146:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
  /* "splitPixel.pyx":146
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef double min0, max0, deltaR, deltaL, deltaA
 *     cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outPos, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outPos.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outPos = __pyx_bstruct_outPos.strides[0];
      __pyx_bshape_0_outPos = __pyx_bstruct_outPos.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_outPos = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
 147:     cdef double min0, max0, deltaR, deltaL, deltaA
 148:     cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin
 149:     if pos0Range is not None and len(pos0Range) > 1:
  /* "splitPixel.pyx":149
 *     cdef double min0, max0, deltaR, deltaL, deltaA
 *     cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin
 *     if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)
 */
  __pyx_t_4 = (__pyx_v_pos0Range != Py_None);
  if (__pyx_t_4) {
    __pyx_t_13 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = (__pyx_t_13 > 1);
    __pyx_t_15 = __pyx_t_14;
  } else {
    __pyx_t_15 = __pyx_t_4;
  }
  if (__pyx_t_15) {
 150:         pos0_min = min(pos0Range)
    /* "splitPixel.pyx":150
 *     cdef double pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin
 *     if pos0Range is not None and len(pos0Range) > 1:
 *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
 *         pos0_maxin = max(pos0Range)
 *     else:
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos0_min = __pyx_t_16;
 151:         pos0_maxin = max(pos0Range)
    /* "splitPixel.pyx":151
 *     if pos0Range is not None and len(pos0Range) > 1:
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_pos0_maxin = __pyx_t_16;
    goto __pyx_L6;
  }
  /*else*/ {
 152:     else:
 153:         pos0_min = pos[:, :, 0].min()
  /* "splitPixel.pyx":153
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = pos[:, :, 0].min()             # <<<<<<<<<<<<<<
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
  __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_3);
  __Pyx_GIVEREF(__pyx_k_slice_3);
  __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_4);
  __Pyx_GIVEREF(__pyx_k_slice_4);

    /* "splitPixel.pyx":153
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = pos[:, :, 0].min()             # <<<<<<<<<<<<<<
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_5)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_pos0_min = __pyx_t_16;
  __pyx_k_tuple_5 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
  __Pyx_INCREF(__pyx_k_slice_3);
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_k_slice_3);
  __Pyx_GIVEREF(__pyx_k_slice_3);
  __Pyx_INCREF(__pyx_k_slice_4);
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_k_slice_4);
  __Pyx_GIVEREF(__pyx_k_slice_4);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 154:         pos0_maxin = pos[:, :, 0].max()
  /* "splitPixel.pyx":154
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     if pos1Range is not None and len(pos1Range) > 1:
 */
  __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_6);
  __Pyx_GIVEREF(__pyx_k_slice_6);
  __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 = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_7);
  __Pyx_GIVEREF(__pyx_k_slice_7);

    /* "splitPixel.pyx":154
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     if pos1Range is not None and len(pos1Range) > 1:
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_8)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_pos0_maxin = __pyx_t_16;
  }
  __pyx_L6:;
  __pyx_k_tuple_8 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
  __Pyx_INCREF(__pyx_k_slice_6);
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_k_slice_6);
  __Pyx_GIVEREF(__pyx_k_slice_6);
  __Pyx_INCREF(__pyx_k_slice_7);
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 1, __pyx_k_slice_7);
  __Pyx_GIVEREF(__pyx_k_slice_7);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 155:     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
  /* "splitPixel.pyx":155
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)
 */
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__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 = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __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_2, __pyx_n_s__eps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_pos0_max = __pyx_t_16;
 156:     if pos1Range is not None and len(pos1Range) > 1:
  /* "splitPixel.pyx":156
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 */
  __pyx_t_15 = (__pyx_v_pos1Range != Py_None);
  if (__pyx_t_15) {
    __pyx_t_13 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (__pyx_t_13 > 1);
    __pyx_t_14 = __pyx_t_4;
  } else {
    __pyx_t_14 = __pyx_t_15;
  }
  if (__pyx_t_14) {
 157:         pos1_min = min(pos1Range)
    /* "splitPixel.pyx":157
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
 *         pos1_maxin = max(pos1Range)
 *     else:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pos1_min = __pyx_t_16;
 158:         pos1_maxin = max(pos1Range)
    /* "splitPixel.pyx":158
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos1_maxin = __pyx_t_16;
    goto __pyx_L7;
  }
  /*else*/ {
 159:     else:
 160:         pos1_min = pos[:, :, 1].min()
  /* "splitPixel.pyx":160
 *         pos1_maxin = max(pos1Range)
 *     else:
 *         pos1_min = pos[:, :, 1].min()             # <<<<<<<<<<<<<<
 *         pos1_max = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
  __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_9);
  __Pyx_GIVEREF(__pyx_k_slice_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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_10);
  __Pyx_GIVEREF(__pyx_k_slice_10);

    /* "splitPixel.pyx":160
 *         pos1_maxin = max(pos1Range)
 *     else:
 *         pos1_min = pos[:, :, 1].min()             # <<<<<<<<<<<<<<
 *         pos1_max = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_11)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos1_min = __pyx_t_16;
  __pyx_k_tuple_11 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11));
  __Pyx_INCREF(__pyx_k_slice_9);
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_k_slice_9);
  __Pyx_GIVEREF(__pyx_k_slice_9);
  __Pyx_INCREF(__pyx_k_slice_10);
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, __pyx_k_slice_10);
  __Pyx_GIVEREF(__pyx_k_slice_10);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 161:         pos1_max = pos[:, :, 1].max()
  /* "splitPixel.pyx":161
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_max = pos[:, :, 1].max()             # <<<<<<<<<<<<<<
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))
 */
  __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_12);
  __Pyx_GIVEREF(__pyx_k_slice_12);
  __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_13);
  __Pyx_GIVEREF(__pyx_k_slice_13);

    /* "splitPixel.pyx":161
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_max = pos[:, :, 1].max()             # <<<<<<<<<<<<<<
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_14)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pos1_max = __pyx_t_16;
  }
  __pyx_L7:;
  __pyx_k_tuple_14 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
  __Pyx_INCREF(__pyx_k_slice_12);
  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, __pyx_k_slice_12);
  __Pyx_GIVEREF(__pyx_k_slice_12);
  __Pyx_INCREF(__pyx_k_slice_13);
  PyTuple_SET_ITEM(__pyx_k_tuple_14, 1, __pyx_k_slice_13);
  __Pyx_GIVEREF(__pyx_k_slice_13);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_14, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 162:     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
  /* "splitPixel.pyx":162
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_max = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 *     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))
 *     cdef long   bin = 0
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos1_max = __pyx_t_16;
 163:     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))
  /* "splitPixel.pyx":163
 *         pos1_max = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))             # <<<<<<<<<<<<<<
 *     cdef long   bin = 0
 *     cdef long   i, idx
 */
  __pyx_v_dpos = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((double)__pyx_v_bins));
 164:     cdef long   bin = 0
  /* "splitPixel.pyx":164
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 *     cdef double dpos = (pos0_max - pos0_min) / (< double > (bins))
 *     cdef long   bin = 0             # <<<<<<<<<<<<<<
 *     cdef long   i, idx
 *     cdef double fbin0_min, fbin0_max#, fbin1_min, fbin1_max
 */
  __pyx_v_bin = 0;
 165:     cdef long   i, idx
 166:     cdef double fbin0_min, fbin0_max#, fbin1_min, fbin1_max
 167:     cdef long   bin0_max, bin0_min
 168:     cdef double aeraPixel, a0, b0, c0, d0
 169:     cdef double epsilon = 1e-10
  /* "splitPixel.pyx":169
 *     cdef long   bin0_max, bin0_min
 *     cdef double aeraPixel, a0, b0, c0, d0
 *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_epsilon = 1e-10;
 170: 
 171:     with nogil:
  /* "splitPixel.pyx":171
 *     cdef double epsilon = 1e-10
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "splitPixel.pyx":171
 *     cdef double epsilon = 1e-10
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
  }
 172:         for i in range(bins):
        /* "splitPixel.pyx":172
 * 
 *     with nogil:
 *         for i in range(bins):             # <<<<<<<<<<<<<<
 *                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos
 * 
 */
        __pyx_t_5 = __pyx_v_bins;
        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) {
          __pyx_v_i = __pyx_t_17;
 173:                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos
          /* "splitPixel.pyx":173
 *     with nogil:
 *         for i in range(bins):
 *                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos             # <<<<<<<<<<<<<<
 * 
 *         for idx in range(size):
 */
          __pyx_t_18 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outPos.buf, __pyx_t_18, __pyx_bstride_0_outPos) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos));
        }
 174: 
 175:         for idx in range(size):
        /* "splitPixel.pyx":175
 *                 outPos[i] = pos0_min + (0.5 +< double > i) * dpos
 * 
 *         for idx in range(size):             # <<<<<<<<<<<<<<
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]
 */
        __pyx_t_5 = __pyx_v_size;
        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) {
          __pyx_v_idx = __pyx_t_17;
 176:             data = < double > cdata[idx]
          /* "splitPixel.pyx":176
 * 
 *         for idx in range(size):
 *             data = < double > cdata[idx]             # <<<<<<<<<<<<<<
 *             a0 = < double > cpos[idx, 0, 0]
 *             b0 = < double > cpos[idx, 1, 0]
 */
          __pyx_t_19 = __pyx_v_idx;
          __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_19, __pyx_bstride_0_cdata)));
 177:             a0 = < double > cpos[idx, 0, 0]
          /* "splitPixel.pyx":177
 *         for idx in range(size):
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]             # <<<<<<<<<<<<<<
 *             b0 = < double > cpos[idx, 1, 0]
 *             c0 = < double > cpos[idx, 2, 0]
 */
          __pyx_t_20 = __pyx_v_idx;
          __pyx_t_21 = 0;
          __pyx_t_22 = 0;
          __pyx_v_a0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_20, __pyx_bstride_0_cpos, __pyx_t_21, __pyx_bstride_1_cpos, __pyx_t_22, __pyx_bstride_2_cpos)));
 178:             b0 = < double > cpos[idx, 1, 0]
          /* "splitPixel.pyx":178
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]
 *             b0 = < double > cpos[idx, 1, 0]             # <<<<<<<<<<<<<<
 *             c0 = < double > cpos[idx, 2, 0]
 *             d0 = < double > cpos[idx, 3, 0]
 */
          __pyx_t_23 = __pyx_v_idx;
          __pyx_t_24 = 1;
          __pyx_t_25 = 0;
          __pyx_v_b0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_23, __pyx_bstride_0_cpos, __pyx_t_24, __pyx_bstride_1_cpos, __pyx_t_25, __pyx_bstride_2_cpos)));
 179:             c0 = < double > cpos[idx, 2, 0]
          /* "splitPixel.pyx":179
 *             a0 = < double > cpos[idx, 0, 0]
 *             b0 = < double > cpos[idx, 1, 0]
 *             c0 = < double > cpos[idx, 2, 0]             # <<<<<<<<<<<<<<
 *             d0 = < double > cpos[idx, 3, 0]
 *             min0 = min4f(a0, b0, c0, d0)
 */
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_27 = 2;
          __pyx_t_28 = 0;
          __pyx_v_c0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_26, __pyx_bstride_0_cpos, __pyx_t_27, __pyx_bstride_1_cpos, __pyx_t_28, __pyx_bstride_2_cpos)));
 180:             d0 = < double > cpos[idx, 3, 0]
          /* "splitPixel.pyx":180
 *             b0 = < double > cpos[idx, 1, 0]
 *             c0 = < double > cpos[idx, 2, 0]
 *             d0 = < double > cpos[idx, 3, 0]             # <<<<<<<<<<<<<<
 *             min0 = min4f(a0, b0, c0, d0)
 *             max0 = max4f(a0, b0, c0, d0)
 */
          __pyx_t_29 = __pyx_v_idx;
          __pyx_t_30 = 3;
          __pyx_t_31 = 0;
          __pyx_v_d0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_29, __pyx_bstride_0_cpos, __pyx_t_30, __pyx_bstride_1_cpos, __pyx_t_31, __pyx_bstride_2_cpos)));
 181:             min0 = min4f(a0, b0, c0, d0)
          /* "splitPixel.pyx":181
 *             c0 = < double > cpos[idx, 2, 0]
 *             d0 = < double > cpos[idx, 3, 0]
 *             min0 = min4f(a0, b0, c0, d0)             # <<<<<<<<<<<<<<
 *             max0 = max4f(a0, b0, c0, d0)
 * 
 */
          __pyx_v_min0 = __pyx_f_10splitPixel_min4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0);
 182:             max0 = max4f(a0, b0, c0, d0)
          /* "splitPixel.pyx":182
 *             d0 = < double > cpos[idx, 3, 0]
 *             min0 = min4f(a0, b0, c0, d0)
 *             max0 = max4f(a0, b0, c0, d0)             # <<<<<<<<<<<<<<
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 */
          __pyx_v_max0 = __pyx_f_10splitPixel_max4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0);
 183: 
 184:             fbin0_min = getBinNr(min0, pos0_min, dpos)
          /* "splitPixel.pyx":184
 *             max0 = max4f(a0, b0, c0, d0)
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)             # <<<<<<<<<<<<<<
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)
 */
          __pyx_v_fbin0_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos);
 185:             fbin0_max = getBinNr(max0, pos0_min, dpos)
          /* "splitPixel.pyx":185
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)             # <<<<<<<<<<<<<<
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)
 */
          __pyx_v_fbin0_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos);
 186:             bin0_min = < long > floor(fbin0_min)
          /* "splitPixel.pyx":186
 *             fbin0_min = getBinNr(min0, pos0_min, dpos)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)             # <<<<<<<<<<<<<<
 *             bin0_max = < long > floor(fbin0_max)
 * 
 */
          __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min));
 187:             bin0_max = < long > floor(fbin0_max)
          /* "splitPixel.pyx":187
 *             fbin0_max = getBinNr(max0, pos0_min, dpos)
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)             # <<<<<<<<<<<<<<
 * 
 *             if bin0_min == bin0_max:
 */
          __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max));
 188: 
 189:             if bin0_min == bin0_max:
          /* "splitPixel.pyx":189
 *             bin0_max = < long > floor(fbin0_max)
 * 
 *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += 1.0
 */
          __pyx_t_14 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
          if (__pyx_t_14) {
 190:                 #All pixel is within a single bin
 191:                 outCount[bin0_min] += 1.0
            /* "splitPixel.pyx":191
 *             if bin0_min == bin0_max:
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += 1.0             # <<<<<<<<<<<<<<
 *                 outData[bin0_min] += data
 * 
 */
            __pyx_t_32 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_32, __pyx_bstride_0_outCount) += 1.0;
 192:                 outData[bin0_min] += data
            /* "splitPixel.pyx":192
 *                 #All pixel is within a single bin
 *                 outCount[bin0_min] += 1.0
 *                 outData[bin0_min] += data             # <<<<<<<<<<<<<<
 * 
 *     #        else we have pixel spliting.
 */
            __pyx_t_33 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_33, __pyx_bstride_0_outData) += __pyx_v_data;
            goto __pyx_L15;
          }
          /*else*/ {
 193: 
 194:     #        else we have pixel spliting.
 195:             else:
 196:                 aeraPixel = fbin0_max - fbin0_min
            /* "splitPixel.pyx":196
 *     #        else we have pixel spliting.
 *             else:
 *                 aeraPixel = fbin0_max - fbin0_min             # <<<<<<<<<<<<<<
 *                 deltaA = 1.0 / aeraPixel
 * 
 */
            __pyx_v_aeraPixel = (__pyx_v_fbin0_max - __pyx_v_fbin0_min);
 197:                 deltaA = 1.0 / aeraPixel
            /* "splitPixel.pyx":197
 *             else:
 *                 aeraPixel = fbin0_max - fbin0_min
 *                 deltaA = 1.0 / aeraPixel             # <<<<<<<<<<<<<<
 * 
 *                 deltaL = < double > (bin0_min + 1) - fbin0_min
 */
            __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel);
 198: 
 199:                 deltaL = < double > (bin0_min + 1) - fbin0_min
            /* "splitPixel.pyx":199
 *                 deltaA = 1.0 / aeraPixel
 * 
 *                 deltaL = < double > (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
 *                 deltaR = fbin0_max - (< double > bin0_max)
 * 
 */
            __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 200:                 deltaR = fbin0_max - (< double > bin0_max)
            /* "splitPixel.pyx":200
 * 
 *                 deltaL = < double > (bin0_min + 1) - fbin0_min
 *                 deltaR = fbin0_max - (< double > bin0_max)             # <<<<<<<<<<<<<<
 * 
 *                 outCount[bin0_min] += deltaA * deltaL
 */
            __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max));
 201: 
 202:                 outCount[bin0_min] += deltaA * deltaL
            /* "splitPixel.pyx":202
 *                 deltaR = fbin0_max - (< double > bin0_max)
 * 
 *                 outCount[bin0_min] += deltaA * deltaL             # <<<<<<<<<<<<<<
 *                 outData[bin0_min] += data * deltaA * deltaL
 * 
 */
            __pyx_t_34 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_34, __pyx_bstride_0_outCount) += (__pyx_v_deltaA * __pyx_v_deltaL);
 203:                 outData[bin0_min] += data * deltaA * deltaL
            /* "splitPixel.pyx":203
 * 
 *                 outCount[bin0_min] += deltaA * deltaL
 *                 outData[bin0_min] += data * deltaA * deltaL             # <<<<<<<<<<<<<<
 * 
 *                 outCount[bin0_max] += deltaA * deltaR
 */
            __pyx_t_35 = __pyx_v_bin0_min;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_35, __pyx_bstride_0_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
 204: 
 205:                 outCount[bin0_max] += deltaA * deltaR
            /* "splitPixel.pyx":205
 *                 outData[bin0_min] += data * deltaA * deltaL
 * 
 *                 outCount[bin0_max] += deltaA * deltaR             # <<<<<<<<<<<<<<
 *                 outData[bin0_max] += data * deltaA * deltaR
 * 
 */
            __pyx_t_36 = __pyx_v_bin0_max;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_36, __pyx_bstride_0_outCount) += (__pyx_v_deltaA * __pyx_v_deltaR);
 206:                 outData[bin0_max] += data * deltaA * deltaR
            /* "splitPixel.pyx":206
 * 
 *                 outCount[bin0_max] += deltaA * deltaR
 *                 outData[bin0_max] += data * deltaA * deltaR             # <<<<<<<<<<<<<<
 * 
 *                 if bin0_min + 1 != bin0_max:
 */
            __pyx_t_37 = __pyx_v_bin0_max;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_37, __pyx_bstride_0_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
 207: 
 208:                 if bin0_min + 1 != bin0_max:
            /* "splitPixel.pyx":208
 *                 outData[bin0_max] += data * deltaA * deltaR
 * 
 *                 if bin0_min + 1 != bin0_max:             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += deltaA
 */
            __pyx_t_14 = ((__pyx_v_bin0_min + 1) != __pyx_v_bin0_max);
            if (__pyx_t_14) {
 209:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitPixel.pyx":209
 * 
 *                 if bin0_min + 1 != bin0_max:
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                         outCount[i] += deltaA
 *                         outData[i] += data * deltaA
 */
              __pyx_t_38 = __pyx_v_bin0_max;
              for (__pyx_t_39 = (__pyx_v_bin0_min + 1); __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
                __pyx_v_i = __pyx_t_39;
 210:                         outCount[i] += deltaA
                /* "splitPixel.pyx":210
 *                 if bin0_min + 1 != bin0_max:
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += deltaA             # <<<<<<<<<<<<<<
 *                         outData[i] += data * deltaA
 * 
 */
                __pyx_t_40 = __pyx_v_i;
                *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_40, __pyx_bstride_0_outCount) += __pyx_v_deltaA;
 211:                         outData[i] += data * deltaA
                /* "splitPixel.pyx":211
 *                     for i in range(bin0_min + 1, bin0_max):
 *                         outCount[i] += deltaA
 *                         outData[i] += data * deltaA             # <<<<<<<<<<<<<<
 * 
 *         for i in range(bins):
 */
                __pyx_t_41 = __pyx_v_i;
                *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_41, __pyx_bstride_0_outData) += (__pyx_v_data * __pyx_v_deltaA);
              }
              goto __pyx_L16;
            }
            __pyx_L16:;
          }
          __pyx_L15:;
        }
 212: 
 213:         for i in range(bins):
        /* "splitPixel.pyx":213
 *                         outData[i] += data * deltaA
 * 
 *         for i in range(bins):             # <<<<<<<<<<<<<<
 *                 if outCount[i] > epsilon:
 *                     outMerge[i] = outData[i] / outCount[i]
 */
        __pyx_t_5 = __pyx_v_bins;
        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_5; __pyx_t_17+=1) {
          __pyx_v_i = __pyx_t_17;
 214:                 if outCount[i] > epsilon:
          /* "splitPixel.pyx":214
 * 
 *         for i in range(bins):
 *                 if outCount[i] > epsilon:             # <<<<<<<<<<<<<<
 *                     outMerge[i] = outData[i] / outCount[i]
 *                 else:
 */
          __pyx_t_38 = __pyx_v_i;
          __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_38, __pyx_bstride_0_outCount)) > __pyx_v_epsilon);
          if (__pyx_t_14) {
 215:                     outMerge[i] = outData[i] / outCount[i]
            /* "splitPixel.pyx":215
 *         for i in range(bins):
 *                 if outCount[i] > epsilon:
 *                     outMerge[i] = outData[i] / outCount[i]             # <<<<<<<<<<<<<<
 *                 else:
 *                     outMerge[i] = dummy
 */
            __pyx_t_39 = __pyx_v_i;
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_43 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_43, __pyx_bstride_0_outMerge) = ((*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_39, __pyx_bstride_0_outData)) / (*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_42, __pyx_bstride_0_outCount)));
            goto __pyx_L21;
          }
          /*else*/ {
 216:                 else:
 217:                     outMerge[i] = dummy
            /* "splitPixel.pyx":217
 *                     outMerge[i] = outData[i] / outCount[i]
 *                 else:
 *                     outMerge[i] = dummy             # <<<<<<<<<<<<<<
 * 
 *     return  outPos, outMerge, outData, outCount
 */
            __pyx_t_44 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_44, __pyx_bstride_0_outMerge) = __pyx_v_dummy;
          }
          __pyx_L21:;
        }
      }
 218: 
 219:     return  outPos, outMerge, outData, outCount
  /* "splitPixel.pyx":219
 *                     outMerge[i] = dummy
 * 
 *     return  outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_outPos));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_outPos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos));
  __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
  PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 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_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("splitPixel.fullSplit1D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outPos);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_outPos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 220: 
 221: 
 222: 
 223: 
 224: 
 225: 
 226: @cython.cdivision(True)
 227: @cython.boundscheck(False)
 228: @cython.wraparound(False)
 229: def fullSplit2D(numpy.ndarray pos not None,
/* "splitPixel.pyx":229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit2D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray weights not None,
 *                 bins not None,
 */

static PyObject *__pyx_pf_10splitPixel_1fullSplit2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10splitPixel_1fullSplit2D[] = "\n    Calculate 2D histogram of pos weighted by weights\n    \n    Splitting is done on the pixel's bounding box like fit2D\n    \n    \n    @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi\n    @param weights: array with intensities\n    @param bins: number of output bins int or 2-tuple of int\n    @param pos0Range: minimum and maximum  of the 2th range\n    @param pos1Range: minimum and maximum  of the chi range\n    @param dummy: value for bins without pixels \n    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)\n    ";
static PyMethodDef __pyx_mdef_10splitPixel_1fullSplit2D = {__Pyx_NAMESTR("fullSplit2D"), (PyCFunction)__pyx_pf_10splitPixel_1fullSplit2D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10splitPixel_1fullSplit2D)};
static PyObject *__pyx_pf_10splitPixel_1fullSplit2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pos = 0;
  PyArrayObject *__pyx_v_weights = 0;
  PyObject *__pyx_v_bins = 0;
  PyObject *__pyx_v_pos0Range = 0;
  PyObject *__pyx_v_pos1Range = 0;
  double __pyx_v_dummy;
  long __pyx_v_bins0;
  long __pyx_v_bins1;
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_v_idx;
  long __pyx_v_size;
  PyArrayObject *__pyx_v_cpos = 0;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_outData = 0;
  PyArrayObject *__pyx_v_outCount = 0;
  PyArrayObject *__pyx_v_outMerge = 0;
  PyArrayObject *__pyx_v_edges0 = 0;
  PyArrayObject *__pyx_v_edges1 = 0;
  double __pyx_v_min0;
  double __pyx_v_max0;
  double __pyx_v_min1;
  double __pyx_v_max1;
  double __pyx_v_deltaR;
  double __pyx_v_deltaL;
  double __pyx_v_deltaU;
  double __pyx_v_deltaD;
  double __pyx_v_deltaA;
  double __pyx_v_pos0_min;
  double __pyx_v_pos0_max;
  double __pyx_v_pos1_min;
  double __pyx_v_pos1_max;
  double __pyx_v_pos0_maxin;
  double __pyx_v_pos1_maxin;
  double __pyx_v_fbin0_min;
  double __pyx_v_fbin0_max;
  double __pyx_v_fbin1_min;
  double __pyx_v_fbin1_max;
  long __pyx_v_bin0_max;
  long __pyx_v_bin0_min;
  long __pyx_v_bin1_max;
  long __pyx_v_bin1_min;
  double __pyx_v_aeraPixel;
  double __pyx_v_a0;
  double __pyx_v_a1;
  double __pyx_v_b0;
  double __pyx_v_b1;
  double __pyx_v_c0;
  double __pyx_v_c1;
  double __pyx_v_d0;
  double __pyx_v_d1;
  double __pyx_v_epsilon;
  double __pyx_v_dpos0;
  double __pyx_v_dpos1;
  double __pyx_v_data;
  Py_buffer __pyx_bstruct_edges0;
  Py_ssize_t __pyx_bstride_0_edges0 = 0;
  Py_ssize_t __pyx_bshape_0_edges0 = 0;
  Py_buffer __pyx_bstruct_edges1;
  Py_ssize_t __pyx_bstride_0_edges1 = 0;
  Py_ssize_t __pyx_bshape_0_edges1 = 0;
  Py_buffer __pyx_bstruct_outMerge;
  Py_ssize_t __pyx_bstride_0_outMerge = 0;
  Py_ssize_t __pyx_bstride_1_outMerge = 0;
  Py_ssize_t __pyx_bshape_0_outMerge = 0;
  Py_ssize_t __pyx_bshape_1_outMerge = 0;
  Py_buffer __pyx_bstruct_outCount;
  Py_ssize_t __pyx_bstride_0_outCount = 0;
  Py_ssize_t __pyx_bstride_1_outCount = 0;
  Py_ssize_t __pyx_bshape_0_outCount = 0;
  Py_ssize_t __pyx_bshape_1_outCount = 0;
  Py_buffer __pyx_bstruct_cdata;
  Py_ssize_t __pyx_bstride_0_cdata = 0;
  Py_ssize_t __pyx_bshape_0_cdata = 0;
  Py_buffer __pyx_bstruct_cpos;
  Py_ssize_t __pyx_bstride_0_cpos = 0;
  Py_ssize_t __pyx_bstride_1_cpos = 0;
  Py_ssize_t __pyx_bstride_2_cpos = 0;
  Py_ssize_t __pyx_bshape_0_cpos = 0;
  Py_ssize_t __pyx_bshape_1_cpos = 0;
  Py_ssize_t __pyx_bshape_2_cpos = 0;
  Py_buffer __pyx_bstruct_outData;
  Py_ssize_t __pyx_bstride_0_outData = 0;
  Py_ssize_t __pyx_bstride_1_outData = 0;
  Py_ssize_t __pyx_bshape_0_outData = 0;
  Py_ssize_t __pyx_bshape_1_outData = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__weights,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fullSplit2D");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};

  /* "splitPixel.pyx":229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit2D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray weights not None,
 *                 bins not None,
 */
  __pyx_k_tuple_48 = PyTuple_New(55); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_n_s__pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 1, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 2, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 3, ((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 4, ((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 5, ((PyObject *)__pyx_n_s__dummy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 6, ((PyObject *)__pyx_n_s__bins0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 7, ((PyObject *)__pyx_n_s__bins1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 8, ((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_48, 9, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 10, ((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_48, 11, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 12, ((PyObject *)__pyx_n_s__cpos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 13, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 14, ((PyObject *)__pyx_n_s__outData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 15, ((PyObject *)__pyx_n_s__outCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 16, ((PyObject *)__pyx_n_s__outMerge));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 17, ((PyObject *)__pyx_n_s__edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 18, ((PyObject *)__pyx_n_s__edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 19, ((PyObject *)__pyx_n_s__min0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 20, ((PyObject *)__pyx_n_s__max0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 21, ((PyObject *)__pyx_n_s__min1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 22, ((PyObject *)__pyx_n_s__max1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 23, ((PyObject *)__pyx_n_s__deltaR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 24, ((PyObject *)__pyx_n_s__deltaL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 25, ((PyObject *)__pyx_n_s__deltaU));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 26, ((PyObject *)__pyx_n_s__deltaD));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 27, ((PyObject *)__pyx_n_s__deltaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 28, ((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 29, ((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 30, ((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 31, ((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 32, ((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 33, ((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 34, ((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 35, ((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 36, ((PyObject *)__pyx_n_s__fbin1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 37, ((PyObject *)__pyx_n_s__fbin1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 38, ((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 39, ((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 40, ((PyObject *)__pyx_n_s__bin1_max));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 41, ((PyObject *)__pyx_n_s__bin1_min));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 42, ((PyObject *)__pyx_n_s__aeraPixel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 43, ((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_48, 44, ((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_48, 45, ((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_48, 46, ((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_48, 47, ((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_48, 48, ((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_48, 49, ((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_48, 50, ((PyObject *)__pyx_n_s__d1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 51, ((PyObject *)__pyx_n_s__epsilon));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 52, ((PyObject *)__pyx_n_s__dpos0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 53, ((PyObject *)__pyx_n_s__dpos1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 54, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));

  /* "splitPixel.pyx":229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def fullSplit2D(numpy.ndarray pos not None,             # <<<<<<<<<<<<<<
 *                 numpy.ndarray weights not None,
 *                 bins not None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_1fullSplit2D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit2D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 230:                 numpy.ndarray weights not None,
 231:                 bins not None,
 232:                 pos0Range=None,
    /* "splitPixel.pyx":232
 *                 numpy.ndarray weights not None,
 *                 bins not None,
 *                 pos0Range=None,             # <<<<<<<<<<<<<<
 *                 pos1Range=None,
 *                 double dummy=0.0):
 */
    values[3] = ((PyObject *)Py_None);
 233:                 pos1Range=None,
    /* "splitPixel.pyx":233
 *                 bins not None,
 *                 pos0Range=None,
 *                 pos1Range=None,             # <<<<<<<<<<<<<<
 *                 double dummy=0.0):
 *     """
 */
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fullSplit2D") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pos = ((PyArrayObject *)values[0]);
    __pyx_v_weights = ((PyArrayObject *)values[1]);
    __pyx_v_bins = values[2];
    __pyx_v_pos0Range = values[3];
    __pyx_v_pos1Range = values[4];
    if (values[5]) {
      __pyx_v_dummy = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dummy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
 234:                 double dummy=0.0):
      /* "splitPixel.pyx":234
 *                 pos0Range=None,
 *                 pos1Range=None,
 *                 double dummy=0.0):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate 2D histogram of pos weighted by weights
 */
      __pyx_v_dummy = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fullSplit2D", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_cpos.buf = NULL;
  __pyx_bstruct_cdata.buf = NULL;
  __pyx_bstruct_outData.buf = NULL;
  __pyx_bstruct_outCount.buf = NULL;
  __pyx_bstruct_outMerge.buf = NULL;
  __pyx_bstruct_edges0.buf = NULL;
  __pyx_bstruct_edges1.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(((PyObject *)__pyx_v_bins) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument 'bins' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
 235:     """
 236:     Calculate 2D histogram of pos weighted by weights
 237: 
 238:     Splitting is done on the pixel's bounding box like fit2D
 239: 
 240: 
 241:     @param pos: 3D array with pos0; Corner A,B,C,D; tth or chi
 242:     @param weights: array with intensities
 243:     @param bins: number of output bins int or 2-tuple of int
 244:     @param pos0Range: minimum and maximum  of the 2th range
 245:     @param pos1Range: minimum and maximum  of the chi range
 246:     @param dummy: value for bins without pixels
 247:     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
 248:     """
 249:     cdef long  bins0, bins1, i, j, idx
 250:     cdef long  size = weights.size
  /* "splitPixel.pyx":250
 *     """
 *     cdef long  bins0, bins1, i, j, idx
 *     cdef long  size = weights.size             # <<<<<<<<<<<<<<
 *     assert pos.shape[0] == weights.size
 *     assert pos.shape[1] == 4 # 4 corners
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_size = __pyx_t_2;
 251:     assert pos.shape[0] == weights.size
  /* "splitPixel.pyx":251
 *     cdef long  bins0, bins1, i, j, idx
 *     cdef long  size = weights.size
 *     assert pos.shape[0] == weights.size             # <<<<<<<<<<<<<<
 *     assert pos.shape[1] == 4 # 4 corners
 *     assert pos.shape[2] == 2 # tth and chi
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 252:     assert pos.shape[1] == 4 # 4 corners
  /* "splitPixel.pyx":252
 *     cdef long  size = weights.size
 *     assert pos.shape[0] == weights.size
 *     assert pos.shape[1] == 4 # 4 corners             # <<<<<<<<<<<<<<
 *     assert pos.shape[2] == 2 # tth and chi
 *     assert pos.ndim == 3
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 253:     assert pos.shape[2] == 2 # tth and chi
  /* "splitPixel.pyx":253
 *     assert pos.shape[0] == weights.size
 *     assert pos.shape[1] == 4 # 4 corners
 *     assert pos.shape[2] == 2 # tth and chi             # <<<<<<<<<<<<<<
 *     assert pos.ndim == 3
 *     try:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 254:     assert pos.ndim == 3
  /* "splitPixel.pyx":254
 *     assert pos.shape[1] == 4 # 4 corners
 *     assert pos.shape[2] == 2 # tth and chi
 *     assert pos.ndim == 3             # <<<<<<<<<<<<<<
 *     try:
 *         bins0, bins1 = tuple(bins)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_pos->nd == 3))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 255:     try:
  /* "splitPixel.pyx":255
 *     assert pos.shape[2] == 2 # tth and chi
 *     assert pos.ndim == 3
 *     try:             # <<<<<<<<<<<<<<
 *         bins0, bins1 = tuple(bins)
 *     except:
 */
  {
    __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:*/ {
 256:         bins0, bins1 = tuple(bins)
      /* "splitPixel.pyx":256
 *     assert pos.ndim == 3
 *     try:
 *         bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
 *     except:
 *         bins0 = bins1 = < long > bins
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_bins);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bins);
      __Pyx_GIVEREF(__pyx_v_bins);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (likely(PyTuple_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_3, 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      }
      __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_bins0 = __pyx_t_2;
      __pyx_v_bins1 = __pyx_t_9;
    }
    __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_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 257:     except:
    /* "splitPixel.pyx":257
 *     try:
 *         bins0, bins1 = tuple(bins)
 *     except:             # <<<<<<<<<<<<<<
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:
 */
    /*except:*/ {
      __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
 258:         bins0 = bins1 = < long > bins
      /* "splitPixel.pyx":258
 *         bins0, bins1 = tuple(bins)
 *     except:
 *         bins0 = bins1 = < long > bins             # <<<<<<<<<<<<<<
 *     if bins0 <= 0:
 *         bins0 = 1
 */
      __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __pyx_v_bins0 = ((long)__pyx_t_9);
      __pyx_v_bins1 = ((long)__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_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_L7_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_L13_try_end:;
  }
 259:     if bins0 <= 0:
  /* "splitPixel.pyx":259
 *     except:
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:             # <<<<<<<<<<<<<<
 *         bins0 = 1
 *     if bins1 <= 0:
 */
  __pyx_t_5 = (__pyx_v_bins0 <= 0);
  if (__pyx_t_5) {
 260:         bins0 = 1
    /* "splitPixel.pyx":260
 *         bins0 = bins1 = < long > bins
 *     if bins0 <= 0:
 *         bins0 = 1             # <<<<<<<<<<<<<<
 *     if bins1 <= 0:
 *         bins1 = 1
 */
    __pyx_v_bins0 = 1;
    goto __pyx_L16;
  }
  __pyx_L16:;
 261:     if bins1 <= 0:
  /* "splitPixel.pyx":261
 *     if bins0 <= 0:
 *         bins0 = 1
 *     if bins1 <= 0:             # <<<<<<<<<<<<<<
 *         bins1 = 1
 * 
 */
  __pyx_t_5 = (__pyx_v_bins1 <= 0);
  if (__pyx_t_5) {
 262:         bins1 = 1
    /* "splitPixel.pyx":262
 *         bins0 = 1
 *     if bins1 <= 0:
 *         bins1 = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_bins1 = 1;
    goto __pyx_L17;
  }
  __pyx_L17:;
 263: 
 264: 
 265:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
  /* "splitPixel.pyx":265
 * 
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cpos, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_cpos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cpos.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cpos = __pyx_bstruct_cpos.strides[0]; __pyx_bstride_1_cpos = __pyx_bstruct_cpos.strides[1]; __pyx_bstride_2_cpos = __pyx_bstruct_cpos.strides[2];
      __pyx_bshape_0_cpos = __pyx_bstruct_cpos.shape[0]; __pyx_bshape_1_cpos = __pyx_bstruct_cpos.shape[1]; __pyx_bshape_2_cpos = __pyx_bstruct_cpos.shape[2];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_cpos = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "splitPixel.pyx":265
 * 
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 266:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
  /* "splitPixel.pyx":266
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __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_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0];
      __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "splitPixel.pyx":266
 * 
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 267:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
  /* "splitPixel.pyx":267
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 3] cpos = pos.astype("float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_12));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_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;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outData, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outData = __pyx_bstruct_outData.strides[0]; __pyx_bstride_1_outData = __pyx_bstruct_outData.strides[1];
      __pyx_bshape_0_outData = __pyx_bstruct_outData.shape[0]; __pyx_bshape_1_outData = __pyx_bstruct_outData.shape[1];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_outData = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 268:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
  /* "splitPixel.pyx":268
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_12, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outCount, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outCount.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outCount = __pyx_bstruct_outCount.strides[0]; __pyx_bstride_1_outCount = __pyx_bstruct_outCount.strides[1];
      __pyx_bshape_0_outCount = __pyx_bstruct_outCount.shape[0]; __pyx_bshape_1_outCount = __pyx_bstruct_outCount.shape[1];
    }
  }
  __pyx_t_14 = 0;
  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 269:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")
  /* "splitPixel.pyx":269
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __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 = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_12));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_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;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 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 = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_outMerge, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_outMerge.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_outMerge = __pyx_bstruct_outMerge.strides[0]; __pyx_bstride_1_outMerge = __pyx_bstruct_outMerge.strides[1];
      __pyx_bshape_0_outMerge = __pyx_bstruct_outMerge.shape[0]; __pyx_bshape_1_outMerge = __pyx_bstruct_outMerge.shape[1];
    }
  }
  __pyx_t_15 = 0;
  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
 270:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64")
  /* "splitPixel.pyx":270
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64")             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64")
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 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 = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_12, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges0, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges0.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_edges0 = __pyx_bstruct_edges0.strides[0];
      __pyx_bshape_0_edges0 = __pyx_bstruct_edges0.shape[0];
    }
  }
  __pyx_t_16 = 0;
  __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 271:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64")
  /* "splitPixel.pyx":271
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float64")
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float64")             # <<<<<<<<<<<<<<
 * 
 *     cdef double min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_edges1, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_10splitPixel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_edges1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_edges1.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_edges1 = __pyx_bstruct_edges1.strides[0];
      __pyx_bshape_0_edges1 = __pyx_bstruct_edges1.shape[0];
    }
  }
  __pyx_t_17 = 0;
  __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;
 272: 
 273:     cdef double min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA
 274:     cdef double pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
 275: 
 276:     cdef double fbin0_min, fbin0_max, fbin1_min, fbin1_max
 277:     cdef long   bin0_max, bin0_min, bin1_max, bin1_min
 278:     cdef double aeraPixel, a0, a1, b0, b1, c0, c1, d0, d1
 279:     cdef double epsilon = 1e-10
  /* "splitPixel.pyx":279
 *     cdef long   bin0_max, bin0_min, bin1_max, bin1_min
 *     cdef double aeraPixel, a0, a1, b0, b1, c0, c1, d0, d1
 *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
 * 
 *     if pos0Range is not None and len(pos0Range) == 2:
 */
  __pyx_v_epsilon = 1e-10;
 280: 
 281:     if pos0Range is not None and len(pos0Range) == 2:
  /* "splitPixel.pyx":281
 *     cdef double epsilon = 1e-10
 * 
 *     if pos0Range is not None and len(pos0Range) == 2:             # <<<<<<<<<<<<<<
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)
 */
  __pyx_t_5 = (__pyx_v_pos0Range != Py_None);
  if (__pyx_t_5) {
    __pyx_t_18 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_19 = (__pyx_t_18 == 2);
    __pyx_t_20 = __pyx_t_19;
  } else {
    __pyx_t_20 = __pyx_t_5;
  }
  if (__pyx_t_20) {
 282:         pos0_min = min(pos0Range)
    /* "splitPixel.pyx":282
 * 
 *     if pos0Range is not None and len(pos0Range) == 2:
 *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
 *         pos0_maxin = max(pos0Range)
 *     else:
 */
    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos0_min = __pyx_t_21;
 283:         pos0_maxin = max(pos0Range)
    /* "splitPixel.pyx":283
 *     if pos0Range is not None and len(pos0Range) == 2:
 *         pos0_min = min(pos0Range)
 *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_pos0Range);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
    __Pyx_GIVEREF(__pyx_v_pos0Range);
    __pyx_t_12 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_pos0_maxin = __pyx_t_21;
    goto __pyx_L18;
  }
  /*else*/ {
 284:     else:
 285:         pos0_min = pos[:, :, 0].min()
  /* "splitPixel.pyx":285
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = pos[:, :, 0].min()             # <<<<<<<<<<<<<<
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
  __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 = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_17);
  __Pyx_GIVEREF(__pyx_k_slice_17);
  __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_18);
  __Pyx_GIVEREF(__pyx_k_slice_18);

    /* "splitPixel.pyx":285
 *         pos0_maxin = max(pos0Range)
 *     else:
 *         pos0_min = pos[:, :, 0].min()             # <<<<<<<<<<<<<<
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
    __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_19)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_pos0_min = __pyx_t_21;
  __pyx_k_tuple_19 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(__pyx_k_slice_17);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_k_slice_17);
  __Pyx_GIVEREF(__pyx_k_slice_17);
  __Pyx_INCREF(__pyx_k_slice_18);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, __pyx_k_slice_18);
  __Pyx_GIVEREF(__pyx_k_slice_18);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 286:         pos0_maxin = pos[:, :, 0].max()
  /* "splitPixel.pyx":286
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 */
  __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_20);
  __Pyx_GIVEREF(__pyx_k_slice_20);
  __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_21);
  __Pyx_GIVEREF(__pyx_k_slice_21);

    /* "splitPixel.pyx":286
 *     else:
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()             # <<<<<<<<<<<<<<
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 */
    __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_22)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_pos0_maxin = __pyx_t_21;
  }
  __pyx_L18:;
  __pyx_k_tuple_22 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_INCREF(__pyx_k_slice_20);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, __pyx_k_slice_20);
  __Pyx_GIVEREF(__pyx_k_slice_20);
  __Pyx_INCREF(__pyx_k_slice_21);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, __pyx_k_slice_21);
  __Pyx_GIVEREF(__pyx_k_slice_21);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 287:     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
  /* "splitPixel.pyx":287
 *         pos0_min = pos[:, :, 0].min()
 *         pos0_maxin = pos[:, :, 0].max()
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 */
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__double); 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_DECREF(__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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eps); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_int_1, __pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_12, __pyx_t_4); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pos0_max = __pyx_t_21;
 288: 
 289:     if pos1Range is not None and len(pos1Range) > 1:
  /* "splitPixel.pyx":289
 *     pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)
 */
  __pyx_t_20 = (__pyx_v_pos1Range != Py_None);
  if (__pyx_t_20) {
    __pyx_t_18 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_18 > 1);
    __pyx_t_19 = __pyx_t_5;
  } else {
    __pyx_t_19 = __pyx_t_20;
  }
  if (__pyx_t_19) {
 290:         pos1_min = min(pos1Range)
    /* "splitPixel.pyx":290
 * 
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
 *         pos1_maxin = max(pos1Range)
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pos1_min = __pyx_t_21;
 291:         pos1_maxin = max(pos1Range)
    /* "splitPixel.pyx":291
 *     if pos1Range is not None and len(pos1Range) > 1:
 *         pos1_min = min(pos1Range)
 *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 */
    __pyx_t_4 = PyTuple_New(1); 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_INCREF(__pyx_v_pos1Range);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos1Range);
    __Pyx_GIVEREF(__pyx_v_pos1Range);
    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_maxin = __pyx_t_21;
    goto __pyx_L19;
  }
  /*else*/ {
 292:     else:
 293:         pos1_min = pos[:, :, 1].min()
  /* "splitPixel.pyx":293
 *         pos1_maxin = max(pos1Range)
 *     else:
 *         pos1_min = pos[:, :, 1].min()             # <<<<<<<<<<<<<<
 *         pos1_maxin = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
  __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 = 293; __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 = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_24);
  __Pyx_GIVEREF(__pyx_k_slice_24);

    /* "splitPixel.pyx":293
 *         pos1_maxin = max(pos1Range)
 *     else:
 *         pos1_min = pos[:, :, 1].min()             # <<<<<<<<<<<<<<
 *         pos1_maxin = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_25)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__min); 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_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_min = __pyx_t_21;
  __pyx_k_tuple_25 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25));
  __Pyx_INCREF(__pyx_k_slice_23);
  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_k_slice_23);
  __Pyx_GIVEREF(__pyx_k_slice_23);
  __Pyx_INCREF(__pyx_k_slice_24);
  PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, __pyx_k_slice_24);
  __Pyx_GIVEREF(__pyx_k_slice_24);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 294:         pos1_maxin = pos[:, :, 1].max()
  /* "splitPixel.pyx":294
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_maxin = pos[:, :, 1].max()             # <<<<<<<<<<<<<<
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 */
  __pyx_k_slice_26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __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(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_27);
  __Pyx_GIVEREF(__pyx_k_slice_27);

    /* "splitPixel.pyx":294
 *     else:
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_maxin = pos[:, :, 1].max()             # <<<<<<<<<<<<<<
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pos1_maxin = __pyx_t_21;
  }
  __pyx_L19:;
  __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 295:     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
  /* "splitPixel.pyx":295
 *         pos1_min = pos[:, :, 1].min()
 *         pos1_maxin = pos[:, :, 1].max()
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)             # <<<<<<<<<<<<<<
 * 
 *     cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0))
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos1_maxin); 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_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__finfo); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); 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(__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 = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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_12, ((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(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); 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);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_4); 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(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); 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);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_pos1_max = __pyx_t_21;
 296: 
 297:     cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0))
  /* "splitPixel.pyx":297
 *     pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.double).eps)
 * 
 *     cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0))             # <<<<<<<<<<<<<<
 *     cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1))
 * 
 */
  __pyx_v_dpos0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((double)__pyx_v_bins0));
 298:     cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1))
  /* "splitPixel.pyx":298
 * 
 *     cdef double dpos0 = (pos0_max - pos0_min) / (< double > (bins0))
 *     cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1))             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_dpos1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((double)__pyx_v_bins1));
 299: 
 300:     with nogil:
  /* "splitPixel.pyx":300
 *     cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1))
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save = NULL;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

      /* "splitPixel.pyx":300
 *     cdef double dpos1 = (pos1_max - pos1_min) / (< double > (bins1))
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 */
      /*finally:*/ {
        int __pyx_why;
        __pyx_why = 0; goto __pyx_L22;
        __pyx_L21: __pyx_why = 4; goto __pyx_L22;
        __pyx_L22:;
        Py_BLOCK_THREADS
        switch (__pyx_why) {
          case 4: goto __pyx_L1_error;
        }
      }
  }
 301:         for i in range(bins0):
        /* "splitPixel.pyx":301
 * 
 *     with nogil:
 *         for i in range(bins0):             # <<<<<<<<<<<<<<
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):
 */
        __pyx_t_9 = __pyx_v_bins0;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 302:                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
          /* "splitPixel.pyx":302
 *     with nogil:
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0             # <<<<<<<<<<<<<<
 *         for i in range(bins1):
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 */
          __pyx_t_22 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_edges0.buf, __pyx_t_22, __pyx_bstride_0_edges0) = (__pyx_v_pos0_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos0));
        }
 303:         for i in range(bins1):
        /* "splitPixel.pyx":303
 *         for i in range(bins0):
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):             # <<<<<<<<<<<<<<
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 * 
 */
        __pyx_t_9 = __pyx_v_bins1;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 304:                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
          /* "splitPixel.pyx":304
 *                 edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
 *         for i in range(bins1):
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1             # <<<<<<<<<<<<<<
 * 
 *         for idx in range(size):
 */
          __pyx_t_23 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_edges1.buf, __pyx_t_23, __pyx_bstride_0_edges1) = (__pyx_v_pos1_min + ((0.5 + ((double)__pyx_v_i)) * __pyx_v_dpos1));
        }
 305: 
 306:         for idx in range(size):
        /* "splitPixel.pyx":306
 *                 edges1[i] = pos1_min + (0.5 +< double > i) * dpos1
 * 
 *         for idx in range(size):             # <<<<<<<<<<<<<<
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]
 */
        __pyx_t_9 = __pyx_v_size;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_idx = __pyx_t_2;
 307:             data = < double > cdata[idx]
          /* "splitPixel.pyx":307
 * 
 *         for idx in range(size):
 *             data = < double > cdata[idx]             # <<<<<<<<<<<<<<
 *             a0 = < double > cpos[idx, 0, 0]
 *             a1 = < double > cpos[idx, 0, 1]
 */
          __pyx_t_24 = __pyx_v_idx;
          __pyx_v_data = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_24, __pyx_bstride_0_cdata)));
 308:             a0 = < double > cpos[idx, 0, 0]
          /* "splitPixel.pyx":308
 *         for idx in range(size):
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]             # <<<<<<<<<<<<<<
 *             a1 = < double > cpos[idx, 0, 1]
 *             b0 = < double > cpos[idx, 1, 0]
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = 0;
          __pyx_t_27 = 0;
          __pyx_v_a0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_25, __pyx_bstride_0_cpos, __pyx_t_26, __pyx_bstride_1_cpos, __pyx_t_27, __pyx_bstride_2_cpos)));
 309:             a1 = < double > cpos[idx, 0, 1]
          /* "splitPixel.pyx":309
 *             data = < double > cdata[idx]
 *             a0 = < double > cpos[idx, 0, 0]
 *             a1 = < double > cpos[idx, 0, 1]             # <<<<<<<<<<<<<<
 *             b0 = < double > cpos[idx, 1, 0]
 *             b1 = < double > cpos[idx, 1, 1]
 */
          __pyx_t_28 = __pyx_v_idx;
          __pyx_t_29 = 0;
          __pyx_t_30 = 1;
          __pyx_v_a1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_28, __pyx_bstride_0_cpos, __pyx_t_29, __pyx_bstride_1_cpos, __pyx_t_30, __pyx_bstride_2_cpos)));
 310:             b0 = < double > cpos[idx, 1, 0]
          /* "splitPixel.pyx":310
 *             a0 = < double > cpos[idx, 0, 0]
 *             a1 = < double > cpos[idx, 0, 1]
 *             b0 = < double > cpos[idx, 1, 0]             # <<<<<<<<<<<<<<
 *             b1 = < double > cpos[idx, 1, 1]
 *             c0 = < double > cpos[idx, 2, 0]
 */
          __pyx_t_31 = __pyx_v_idx;
          __pyx_t_32 = 1;
          __pyx_t_33 = 0;
          __pyx_v_b0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_31, __pyx_bstride_0_cpos, __pyx_t_32, __pyx_bstride_1_cpos, __pyx_t_33, __pyx_bstride_2_cpos)));
 311:             b1 = < double > cpos[idx, 1, 1]
          /* "splitPixel.pyx":311
 *             a1 = < double > cpos[idx, 0, 1]
 *             b0 = < double > cpos[idx, 1, 0]
 *             b1 = < double > cpos[idx, 1, 1]             # <<<<<<<<<<<<<<
 *             c0 = < double > cpos[idx, 2, 0]
 *             c1 = < double > cpos[idx, 2, 1]
 */
          __pyx_t_34 = __pyx_v_idx;
          __pyx_t_35 = 1;
          __pyx_t_36 = 1;
          __pyx_v_b1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_34, __pyx_bstride_0_cpos, __pyx_t_35, __pyx_bstride_1_cpos, __pyx_t_36, __pyx_bstride_2_cpos)));
 312:             c0 = < double > cpos[idx, 2, 0]
          /* "splitPixel.pyx":312
 *             b0 = < double > cpos[idx, 1, 0]
 *             b1 = < double > cpos[idx, 1, 1]
 *             c0 = < double > cpos[idx, 2, 0]             # <<<<<<<<<<<<<<
 *             c1 = < double > cpos[idx, 2, 1]
 *             d0 = < double > cpos[idx, 3, 0]
 */
          __pyx_t_37 = __pyx_v_idx;
          __pyx_t_38 = 2;
          __pyx_t_39 = 0;
          __pyx_v_c0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_37, __pyx_bstride_0_cpos, __pyx_t_38, __pyx_bstride_1_cpos, __pyx_t_39, __pyx_bstride_2_cpos)));
 313:             c1 = < double > cpos[idx, 2, 1]
          /* "splitPixel.pyx":313
 *             b1 = < double > cpos[idx, 1, 1]
 *             c0 = < double > cpos[idx, 2, 0]
 *             c1 = < double > cpos[idx, 2, 1]             # <<<<<<<<<<<<<<
 *             d0 = < double > cpos[idx, 3, 0]
 *             d1 = < double > cpos[idx, 3, 1]
 */
          __pyx_t_40 = __pyx_v_idx;
          __pyx_t_41 = 2;
          __pyx_t_42 = 1;
          __pyx_v_c1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_40, __pyx_bstride_0_cpos, __pyx_t_41, __pyx_bstride_1_cpos, __pyx_t_42, __pyx_bstride_2_cpos)));
 314:             d0 = < double > cpos[idx, 3, 0]
          /* "splitPixel.pyx":314
 *             c0 = < double > cpos[idx, 2, 0]
 *             c1 = < double > cpos[idx, 2, 1]
 *             d0 = < double > cpos[idx, 3, 0]             # <<<<<<<<<<<<<<
 *             d1 = < double > cpos[idx, 3, 1]
 * 
 */
          __pyx_t_43 = __pyx_v_idx;
          __pyx_t_44 = 3;
          __pyx_t_45 = 0;
          __pyx_v_d0 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_43, __pyx_bstride_0_cpos, __pyx_t_44, __pyx_bstride_1_cpos, __pyx_t_45, __pyx_bstride_2_cpos)));
 315:             d1 = < double > cpos[idx, 3, 1]
          /* "splitPixel.pyx":315
 *             c1 = < double > cpos[idx, 2, 1]
 *             d0 = < double > cpos[idx, 3, 0]
 *             d1 = < double > cpos[idx, 3, 1]             # <<<<<<<<<<<<<<
 * 
 *             min0 = min4f(a0, b0, c0, d0)
 */
          __pyx_t_46 = __pyx_v_idx;
          __pyx_t_47 = 3;
          __pyx_t_48 = 1;
          __pyx_v_d1 = ((double)(*__Pyx_BufPtrStrided3d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_cpos.buf, __pyx_t_46, __pyx_bstride_0_cpos, __pyx_t_47, __pyx_bstride_1_cpos, __pyx_t_48, __pyx_bstride_2_cpos)));
 316: 
 317:             min0 = min4f(a0, b0, c0, d0)
          /* "splitPixel.pyx":317
 *             d1 = < double > cpos[idx, 3, 1]
 * 
 *             min0 = min4f(a0, b0, c0, d0)             # <<<<<<<<<<<<<<
 *             max0 = max4f(a0, b0, c0, d0)
 *             min1 = min4f(a1, b1, c1, d1)
 */
          __pyx_v_min0 = __pyx_f_10splitPixel_min4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0);
 318:             max0 = max4f(a0, b0, c0, d0)
          /* "splitPixel.pyx":318
 * 
 *             min0 = min4f(a0, b0, c0, d0)
 *             max0 = max4f(a0, b0, c0, d0)             # <<<<<<<<<<<<<<
 *             min1 = min4f(a1, b1, c1, d1)
 *             max1 = max4f(a1, b1, c1, d1)
 */
          __pyx_v_max0 = __pyx_f_10splitPixel_max4f(__pyx_v_a0, __pyx_v_b0, __pyx_v_c0, __pyx_v_d0);
 319:             min1 = min4f(a1, b1, c1, d1)
          /* "splitPixel.pyx":319
 *             min0 = min4f(a0, b0, c0, d0)
 *             max0 = max4f(a0, b0, c0, d0)
 *             min1 = min4f(a1, b1, c1, d1)             # <<<<<<<<<<<<<<
 *             max1 = max4f(a1, b1, c1, d1)
 * #            splitOnePixel2D(min0, max0, min1, max1,
 */
          __pyx_v_min1 = __pyx_f_10splitPixel_min4f(__pyx_v_a1, __pyx_v_b1, __pyx_v_c1, __pyx_v_d1);
 320:             max1 = max4f(a1, b1, c1, d1)
          /* "splitPixel.pyx":320
 *             max0 = max4f(a0, b0, c0, d0)
 *             min1 = min4f(a1, b1, c1, d1)
 *             max1 = max4f(a1, b1, c1, d1)             # <<<<<<<<<<<<<<
 * #            splitOnePixel2D(min0, max0, min1, max1,
 * #                      data,
 */
          __pyx_v_max1 = __pyx_f_10splitPixel_max4f(__pyx_v_a1, __pyx_v_b1, __pyx_v_c1, __pyx_v_d1);
 321: #            splitOnePixel2D(min0, max0, min1, max1,
 322: #                      data,
 323: #                      pos0_min, pos1_min,
 324: #                      dpos0, dpos1,
 325: #                      outCount,
 326: #                      outData)
 327: 
 328:             if max0 < pos0_min:
          /* "splitPixel.pyx":328
 * #                      outData)
 * 
 *             if max0 < pos0_min:             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
 */
          __pyx_t_19 = (__pyx_v_max0 < __pyx_v_pos0_min);
          if (__pyx_t_19) {
 329:                 with gil:
            /* "splitPixel.pyx":329
 * 
 *             if max0 < pos0_min:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
 *                 continue
 */
            {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
                #endif
                /*try:*/ {

                /* "splitPixel.pyx":329
 * 
 *             if max0 < pos0_min:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
 *                 continue
 */
                /*finally:*/ {
                  int __pyx_why;
                  __pyx_why = 0; goto __pyx_L34;
                  __pyx_L33: __pyx_why = 4; goto __pyx_L34;
                  __pyx_L34:;
                  #ifdef WITH_THREAD
                  PyGILState_Release(__pyx_gilstate_save);
                  #endif
                  switch (__pyx_why) {
                    case 4: goto __pyx_L21;
                  }
                }
            }
 330:                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
                  /* "splitPixel.pyx":330
 *             if max0 < pos0_min:
 *                 with gil:
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))             # <<<<<<<<<<<<<<
 *                 continue
 *             if max1 < pos1_min:
 */
                  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;}
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;}
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
                  __Pyx_GIVEREF(__pyx_t_4);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
                  __Pyx_GIVEREF(__pyx_t_3);
                  __pyx_t_4 = 0;
                  __pyx_t_3 = 0;
                  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
                  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
                  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L33;}
                  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
                }
 331:                 continue
            /* "splitPixel.pyx":331
 *                 with gil:
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
 *                 continue             # <<<<<<<<<<<<<<
 *             if max1 < pos1_min:
 *                 with gil:
 */
            goto __pyx_L27_continue;
            goto __pyx_L29;
          }
          __pyx_L29:;
 332:             if max1 < pos1_min:
          /* "splitPixel.pyx":332
 *                     print("max0 (%s) < self.pos0_min %s" % (max0 , pos0_min))
 *                 continue
 *             if max1 < pos1_min:             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
 */
          __pyx_t_19 = (__pyx_v_max1 < __pyx_v_pos1_min);
          if (__pyx_t_19) {
 333:                 with gil:
            /* "splitPixel.pyx":333
 *                 continue
 *             if max1 < pos1_min:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
 *                 continue
 */
            {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
                #endif
                /*try:*/ {

                /* "splitPixel.pyx":333
 *                 continue
 *             if max1 < pos1_min:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
 *                 continue
 */
                /*finally:*/ {
                  int __pyx_why;
                  __pyx_why = 0; goto __pyx_L41;
                  __pyx_L40: __pyx_why = 4; goto __pyx_L41;
                  __pyx_L41:;
                  #ifdef WITH_THREAD
                  PyGILState_Release(__pyx_gilstate_save);
                  #endif
                  switch (__pyx_why) {
                    case 4: goto __pyx_L21;
                  }
                }
            }
 334:                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
                  /* "splitPixel.pyx":334
 *             if max1 < pos1_min:
 *                 with gil:
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))             # <<<<<<<<<<<<<<
 *                 continue
 *             if min0 > pos0_maxin:
 */
                  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;}
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;}
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
                  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
                  __Pyx_GIVEREF(__pyx_t_3);
                  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_1);
                  __pyx_t_3 = 0;
                  __pyx_t_1 = 0;
                  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
                  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
                  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L40;}
                  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
                }
 335:                 continue
            /* "splitPixel.pyx":335
 *                 with gil:
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
 *                 continue             # <<<<<<<<<<<<<<
 *             if min0 > pos0_maxin:
 *                 with gil:
 */
            goto __pyx_L27_continue;
            goto __pyx_L36;
          }
          __pyx_L36:;
 336:             if min0 > pos0_maxin:
          /* "splitPixel.pyx":336
 *                     print("max1 (%s) < pos1_min %s" % (max0 , pos0_min))
 *                 continue
 *             if min0 > pos0_maxin:             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
 */
          __pyx_t_19 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
          if (__pyx_t_19) {
 337:                 with gil:
            /* "splitPixel.pyx":337
 *                 continue
 *             if min0 > pos0_maxin:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
 *                 continue
 */
            {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
                #endif
                /*try:*/ {

                /* "splitPixel.pyx":337
 *                 continue
 *             if min0 > pos0_maxin:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
 *                 continue
 */
                /*finally:*/ {
                  int __pyx_why;
                  __pyx_why = 0; goto __pyx_L48;
                  __pyx_L47: __pyx_why = 4; goto __pyx_L48;
                  __pyx_L48:;
                  #ifdef WITH_THREAD
                  PyGILState_Release(__pyx_gilstate_save);
                  #endif
                  switch (__pyx_why) {
                    case 4: goto __pyx_L21;
                  }
                }
            }
 338:                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
                  /* "splitPixel.pyx":338
 *             if min0 > pos0_maxin:
 *                 with gil:
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))             # <<<<<<<<<<<<<<
 *                 continue
 *             if min1 > pos1_maxin:
 */
                  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;}
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;}
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
                  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_1);
                  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
                  __Pyx_GIVEREF(__pyx_t_4);
                  __pyx_t_1 = 0;
                  __pyx_t_4 = 0;
                  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
                  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
                  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L47;}
                  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
                }
 339:                 continue
            /* "splitPixel.pyx":339
 *                 with gil:
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
 *                 continue             # <<<<<<<<<<<<<<
 *             if min1 > pos1_maxin:
 *                 with gil:
 */
            goto __pyx_L27_continue;
            goto __pyx_L43;
          }
          __pyx_L43:;
 340:             if min1 > pos1_maxin:
          /* "splitPixel.pyx":340
 *                     print("min0 (%s) > pos0_maxin %s" % (max0 , pos0_maxin))
 *                 continue
 *             if min1 > pos1_maxin:             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))
 */
          __pyx_t_19 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
          if (__pyx_t_19) {
 341:                 with gil:
            /* "splitPixel.pyx":341
 *                 continue
 *             if min1 > pos1_maxin:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))
 *                 continue
 */
            {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
                #endif
                /*try:*/ {

                /* "splitPixel.pyx":341
 *                 continue
 *             if min1 > pos1_maxin:
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))
 *                 continue
 */
                /*finally:*/ {
                  int __pyx_why;
                  __pyx_why = 0; goto __pyx_L55;
                  __pyx_L54: __pyx_why = 4; goto __pyx_L55;
                  __pyx_L55:;
                  #ifdef WITH_THREAD
                  PyGILState_Release(__pyx_gilstate_save);
                  #endif
                  switch (__pyx_why) {
                    case 4: goto __pyx_L21;
                  }
                }
            }
 342:                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))
                  /* "splitPixel.pyx":342
 *             if min1 > pos1_maxin:
 *                 with gil:
 *                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
                  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_max0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;}
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;}
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
                  __Pyx_GIVEREF(__pyx_t_4);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
                  __Pyx_GIVEREF(__pyx_t_3);
                  __pyx_t_4 = 0;
                  __pyx_t_3 = 0;
                  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;}
                  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
                  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
                  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L54;}
                  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
                }
 343:                 continue
            /* "splitPixel.pyx":343
 *                 with gil:
 *                     print("min1 (%s) > pos1_maxin %s" % (max0 , pos1_maxin))
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if min0 < pos0_min:
 */
            goto __pyx_L27_continue;
            goto __pyx_L50;
          }
          __pyx_L50:;
 344: 
 345:             if min0 < pos0_min:
          /* "splitPixel.pyx":345
 *                 continue
 * 
 *             if min0 < pos0_min:             # <<<<<<<<<<<<<<
 *                 data = data * (pos0_min - min0) / (max0 - min0)
 *                 min0 = pos0_min
 */
          __pyx_t_19 = (__pyx_v_min0 < __pyx_v_pos0_min);
          if (__pyx_t_19) {
 346:                 data = data * (pos0_min - min0) / (max0 - min0)
            /* "splitPixel.pyx":346
 * 
 *             if min0 < pos0_min:
 *                 data = data * (pos0_min - min0) / (max0 - min0)             # <<<<<<<<<<<<<<
 *                 min0 = pos0_min
 *             if min1 < pos1_min:
 */
            __pyx_v_data = ((__pyx_v_data * (__pyx_v_pos0_min - __pyx_v_min0)) / (__pyx_v_max0 - __pyx_v_min0));
 347:                 min0 = pos0_min
            /* "splitPixel.pyx":347
 *             if min0 < pos0_min:
 *                 data = data * (pos0_min - min0) / (max0 - min0)
 *                 min0 = pos0_min             # <<<<<<<<<<<<<<
 *             if min1 < pos1_min:
 *                 data = data * (pos1_min - min1) / (max1 - min1)
 */
            __pyx_v_min0 = __pyx_v_pos0_min;
            goto __pyx_L57;
          }
          __pyx_L57:;
 348:             if min1 < pos1_min:
          /* "splitPixel.pyx":348
 *                 data = data * (pos0_min - min0) / (max0 - min0)
 *                 min0 = pos0_min
 *             if min1 < pos1_min:             # <<<<<<<<<<<<<<
 *                 data = data * (pos1_min - min1) / (max1 - min1)
 *                 min1 = pos1_min
 */
          __pyx_t_19 = (__pyx_v_min1 < __pyx_v_pos1_min);
          if (__pyx_t_19) {
 349:                 data = data * (pos1_min - min1) / (max1 - min1)
            /* "splitPixel.pyx":349
 *                 min0 = pos0_min
 *             if min1 < pos1_min:
 *                 data = data * (pos1_min - min1) / (max1 - min1)             # <<<<<<<<<<<<<<
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:
 */
            __pyx_v_data = ((__pyx_v_data * (__pyx_v_pos1_min - __pyx_v_min1)) / (__pyx_v_max1 - __pyx_v_min1));
 350:                 min1 = pos1_min
            /* "splitPixel.pyx":350
 *             if min1 < pos1_min:
 *                 data = data * (pos1_min - min1) / (max1 - min1)
 *                 min1 = pos1_min             # <<<<<<<<<<<<<<
 *             if max0 > pos0_maxin:
 *                 data = data * (max0 - pos0_maxin) / (max0 - min0)
 */
            __pyx_v_min1 = __pyx_v_pos1_min;
            goto __pyx_L58;
          }
          __pyx_L58:;
 351:             if max0 > pos0_maxin:
          /* "splitPixel.pyx":351
 *                 data = data * (pos1_min - min1) / (max1 - min1)
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:             # <<<<<<<<<<<<<<
 *                 data = data * (max0 - pos0_maxin) / (max0 - min0)
 *                 max0 = pos0_maxin
 */
          __pyx_t_19 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
          if (__pyx_t_19) {
 352:                 data = data * (max0 - pos0_maxin) / (max0 - min0)
            /* "splitPixel.pyx":352
 *                 min1 = pos1_min
 *             if max0 > pos0_maxin:
 *                 data = data * (max0 - pos0_maxin) / (max0 - min0)             # <<<<<<<<<<<<<<
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:
 */
            __pyx_v_data = ((__pyx_v_data * (__pyx_v_max0 - __pyx_v_pos0_maxin)) / (__pyx_v_max0 - __pyx_v_min0));
 353:                 max0 = pos0_maxin
            /* "splitPixel.pyx":353
 *             if max0 > pos0_maxin:
 *                 data = data * (max0 - pos0_maxin) / (max0 - min0)
 *                 max0 = pos0_maxin             # <<<<<<<<<<<<<<
 *             if max1 > pos1_maxin:
 *                 data = data * (max1 - pos1_maxin) / (max1 - min1)
 */
            __pyx_v_max0 = __pyx_v_pos0_maxin;
            goto __pyx_L59;
          }
          __pyx_L59:;
 354:             if max1 > pos1_maxin:
          /* "splitPixel.pyx":354
 *                 data = data * (max0 - pos0_maxin) / (max0 - min0)
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:             # <<<<<<<<<<<<<<
 *                 data = data * (max1 - pos1_maxin) / (max1 - min1)
 *                 max1 = pos1_maxin
 */
          __pyx_t_19 = (__pyx_v_max1 > __pyx_v_pos1_maxin);
          if (__pyx_t_19) {
 355:                 data = data * (max1 - pos1_maxin) / (max1 - min1)
            /* "splitPixel.pyx":355
 *                 max0 = pos0_maxin
 *             if max1 > pos1_maxin:
 *                 data = data * (max1 - pos1_maxin) / (max1 - min1)             # <<<<<<<<<<<<<<
 *                 max1 = pos1_maxin
 * 
 */
            __pyx_v_data = ((__pyx_v_data * (__pyx_v_max1 - __pyx_v_pos1_maxin)) / (__pyx_v_max1 - __pyx_v_min1));
 356:                 max1 = pos1_maxin
            /* "splitPixel.pyx":356
 *             if max1 > pos1_maxin:
 *                 data = data * (max1 - pos1_maxin) / (max1 - min1)
 *                 max1 = pos1_maxin             # <<<<<<<<<<<<<<
 * 
 * ##                treat data for pixel on chi discontinuity
 */
            __pyx_v_max1 = __pyx_v_pos1_maxin;
            goto __pyx_L60;
          }
          __pyx_L60:;
 357: 
 358: ##                treat data for pixel on chi discontinuity
 359:             if ((max1 - min1) / dpos1) > (bins1 / 2.0):
          /* "splitPixel.pyx":359
 * 
 * ##                treat data for pixel on chi discontinuity
 *             if ((max1 - min1) / dpos1) > (bins1 / 2.0):             # <<<<<<<<<<<<<<
 * #                with gil:
 * #                    print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1))
 */
          __pyx_t_19 = (((__pyx_v_max1 - __pyx_v_min1) / __pyx_v_dpos1) > (__pyx_v_bins1 / 2.0));
          if (__pyx_t_19) {
 360: #                with gil:
 361: #                    print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1))
 362:                 if pos1_maxin - max1 > min1 - pos1_min:
            /* "splitPixel.pyx":362
 * #                with gil:
 * #                    print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1))
 *                 if pos1_maxin - max1 > min1 - pos1_min:             # <<<<<<<<<<<<<<
 *                     min1 = max1
 *                     max1 = pos1_maxin
 */
            __pyx_t_19 = ((__pyx_v_pos1_maxin - __pyx_v_max1) > (__pyx_v_min1 - __pyx_v_pos1_min));
            if (__pyx_t_19) {
 363:                     min1 = max1
              /* "splitPixel.pyx":363
 * #                    print("max1: %s; min1: %s; dpos1: %s" % (max1 , min1, dpos1))
 *                 if pos1_maxin - max1 > min1 - pos1_min:
 *                     min1 = max1             # <<<<<<<<<<<<<<
 *                     max1 = pos1_maxin
 *                 else:
 */
              __pyx_v_min1 = __pyx_v_max1;
 364:                     max1 = pos1_maxin
              /* "splitPixel.pyx":364
 *                 if pos1_maxin - max1 > min1 - pos1_min:
 *                     min1 = max1
 *                     max1 = pos1_maxin             # <<<<<<<<<<<<<<
 *                 else:
 *                     max1 = min1
 */
              __pyx_v_max1 = __pyx_v_pos1_maxin;
              goto __pyx_L62;
            }
            /*else*/ {
 365:                 else:
 366:                     max1 = min1
              /* "splitPixel.pyx":366
 *                     max1 = pos1_maxin
 *                 else:
 *                     max1 = min1             # <<<<<<<<<<<<<<
 *                     min1 = pos1_min
 * 
 */
              __pyx_v_max1 = __pyx_v_min1;
 367:                     min1 = pos1_min
              /* "splitPixel.pyx":367
 *                 else:
 *                     max1 = min1
 *                     min1 = pos1_min             # <<<<<<<<<<<<<<
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)
 */
              __pyx_v_min1 = __pyx_v_pos1_min;
            }
            __pyx_L62:;
            goto __pyx_L61;
          }
          __pyx_L61:;
 368: 
 369:             fbin0_min = getBinNr(min0, pos0_min, dpos0)
          /* "splitPixel.pyx":369
 *                     min1 = pos1_min
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)             # <<<<<<<<<<<<<<
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 */
          __pyx_v_fbin0_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_dpos0);
 370:             fbin0_max = getBinNr(max0, pos0_min, dpos0)
          /* "splitPixel.pyx":370
 * 
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)             # <<<<<<<<<<<<<<
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 */
          __pyx_v_fbin0_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_dpos0);
 371:             fbin1_min = getBinNr(min1, pos1_min, dpos1)
          /* "splitPixel.pyx":371
 *             fbin0_min = getBinNr(min0, pos0_min, dpos0)
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)             # <<<<<<<<<<<<<<
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 * 
 */
          __pyx_v_fbin1_min = __pyx_f_10splitPixel_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_dpos1);
 372:             fbin1_max = getBinNr(max1, pos1_min, dpos1)
          /* "splitPixel.pyx":372
 *             fbin0_max = getBinNr(max0, pos0_min, dpos0)
 *             fbin1_min = getBinNr(min1, pos1_min, dpos1)
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)             # <<<<<<<<<<<<<<
 * 
 *             bin0_min = < long > floor(fbin0_min)
 */
          __pyx_v_fbin1_max = __pyx_f_10splitPixel_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_dpos1);
 373: 
 374:             bin0_min = < long > floor(fbin0_min)
          /* "splitPixel.pyx":374
 *             fbin1_max = getBinNr(max1, pos1_min, dpos1)
 * 
 *             bin0_min = < long > floor(fbin0_min)             # <<<<<<<<<<<<<<
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)
 */
          __pyx_v_bin0_min = ((long)floor(__pyx_v_fbin0_min));
 375:             bin0_max = < long > floor(fbin0_max)
          /* "splitPixel.pyx":375
 * 
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)             # <<<<<<<<<<<<<<
 *             bin1_min = < long > floor(fbin1_min)
 *             bin1_max = < long > floor(fbin1_max)
 */
          __pyx_v_bin0_max = ((long)floor(__pyx_v_fbin0_max));
 376:             bin1_min = < long > floor(fbin1_min)
          /* "splitPixel.pyx":376
 *             bin0_min = < long > floor(fbin0_min)
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)             # <<<<<<<<<<<<<<
 *             bin1_max = < long > floor(fbin1_max)
 * 
 */
          __pyx_v_bin1_min = ((long)floor(__pyx_v_fbin1_min));
 377:             bin1_max = < long > floor(fbin1_max)
          /* "splitPixel.pyx":377
 *             bin0_max = < long > floor(fbin0_max)
 *             bin1_min = < long > floor(fbin1_min)
 *             bin1_max = < long > floor(fbin1_max)             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_v_bin1_max = ((long)floor(__pyx_v_fbin1_max));
 378: 
 379: 
 380:             if bin0_min == bin0_max:
          /* "splitPixel.pyx":380
 * 
 * 
 *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
 *                 if bin1_min == bin1_max:
 *                     #All pixel is within a single bin
 */
          __pyx_t_19 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
          if (__pyx_t_19) {
 381:                 if bin1_min == bin1_max:
            /* "splitPixel.pyx":381
 * 
 *             if bin0_min == bin0_max:
 *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0
 */
            __pyx_t_19 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
            if (__pyx_t_19) {
 382:                     #All pixel is within a single bin
 383:                     outCount[bin0_min, bin1_min] += 1.0
              /* "splitPixel.pyx":383
 *                 if bin1_min == bin1_max:
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data
 *                 else:
 */
              __pyx_t_49 = __pyx_v_bin0_min;
              __pyx_t_50 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_49, __pyx_bstride_0_outCount, __pyx_t_50, __pyx_bstride_1_outCount) += 1.0;
 384:                     outData[bin0_min, bin1_min] += data
              /* "splitPixel.pyx":384
 *                     #All pixel is within a single bin
 *                     outCount[bin0_min, bin1_min] += 1.0
 *                     outData[bin0_min, bin1_min] += data             # <<<<<<<<<<<<<<
 *                 else:
 *                     #spread on more than 2 bins
 */
              __pyx_t_51 = __pyx_v_bin0_min;
              __pyx_t_52 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_51, __pyx_bstride_0_outData, __pyx_t_52, __pyx_bstride_1_outData) += __pyx_v_data;
              goto __pyx_L64;
            }
            /*else*/ {
 385:                 else:
 386:                     #spread on more than 2 bins
 387:                     aeraPixel = fbin1_max - fbin1_min
              /* "splitPixel.pyx":387
 *                 else:
 *                     #spread on more than 2 bins
 *                     aeraPixel = fbin1_max - fbin1_min             # <<<<<<<<<<<<<<
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)
 */
              __pyx_v_aeraPixel = (__pyx_v_fbin1_max - __pyx_v_fbin1_min);
 388:                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
              /* "splitPixel.pyx":388
 *                     #spread on more than 2 bins
 *                     aeraPixel = fbin1_max - fbin1_min
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / aeraPixel
 */
              __pyx_v_deltaD = (((double)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 389:                     deltaU = fbin1_max - (< double > bin1_max)
              /* "splitPixel.pyx":389
 *                     aeraPixel = fbin1_max - fbin1_min
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)             # <<<<<<<<<<<<<<
 *                     deltaA = 1.0 / aeraPixel
 * 
 */
              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max));
 390:                     deltaA = 1.0 / aeraPixel
              /* "splitPixel.pyx":390
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / aeraPixel             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaD
 */
              __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel);
 391: 
 392:                     outCount[bin0_min, bin1_min] += deltaA * deltaD
              /* "splitPixel.pyx":392
 *                     deltaA = 1.0 / aeraPixel
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
 * 
 */
              __pyx_t_53 = __pyx_v_bin0_min;
              __pyx_t_54 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_53, __pyx_bstride_0_outCount, __pyx_t_54, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaD);
 393:                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
              /* "splitPixel.pyx":393
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaD
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaU
 */
              __pyx_t_55 = __pyx_v_bin0_min;
              __pyx_t_56 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_55, __pyx_bstride_0_outData, __pyx_t_56, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
 394: 
 395:                     outCount[bin0_min, bin1_max] += deltaA * deltaU
              /* "splitPixel.pyx":395
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
 * #                    if bin1_min +1< bin1_max:
 */
              __pyx_t_57 = __pyx_v_bin0_min;
              __pyx_t_58 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_57, __pyx_bstride_0_outCount, __pyx_t_58, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaU);
 396:                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
              /* "splitPixel.pyx":396
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaU
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU             # <<<<<<<<<<<<<<
 * #                    if bin1_min +1< bin1_max:
 *                     for j in range(bin1_min + 1, bin1_max):
 */
              __pyx_t_59 = __pyx_v_bin0_min;
              __pyx_t_60 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_59, __pyx_bstride_0_outData, __pyx_t_60, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
 397: #                    if bin1_min +1< bin1_max:
 398:                     for j in range(bin1_min + 1, bin1_max):
              /* "splitPixel.pyx":398
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
 * #                    if bin1_min +1< bin1_max:
 *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                             outCount[bin0_min, j] += deltaA
 *                             outData[bin0_min, j] += data * deltaA
 */
              __pyx_t_61 = __pyx_v_bin1_max;
              for (__pyx_t_62 = (__pyx_v_bin1_min + 1); __pyx_t_62 < __pyx_t_61; __pyx_t_62+=1) {
                __pyx_v_j = __pyx_t_62;
 399:                             outCount[bin0_min, j] += deltaA
                /* "splitPixel.pyx":399
 * #                    if bin1_min +1< bin1_max:
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += deltaA             # <<<<<<<<<<<<<<
 *                             outData[bin0_min, j] += data * deltaA
 * 
 */
                __pyx_t_63 = __pyx_v_bin0_min;
                __pyx_t_64 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_63, __pyx_bstride_0_outCount, __pyx_t_64, __pyx_bstride_1_outCount) += __pyx_v_deltaA;
 400:                             outData[bin0_min, j] += data * deltaA
                /* "splitPixel.pyx":400
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += deltaA
 *                             outData[bin0_min, j] += data * deltaA             # <<<<<<<<<<<<<<
 * 
 *             else: #spread on more than 2 bins in dim 0
 */
                __pyx_t_65 = __pyx_v_bin0_min;
                __pyx_t_66 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_65, __pyx_bstride_0_outData, __pyx_t_66, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA);
              }
            }
            __pyx_L64:;
            goto __pyx_L63;
          }
          /*else*/ {
 401: 
 402:             else: #spread on more than 2 bins in dim 0
 403:                 if bin1_min == bin1_max:
            /* "splitPixel.pyx":403
 * 
 *             else: #spread on more than 2 bins in dim 0
 *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
 *                     #All pixel fall on 1 bins in dim 1
 *                     aeraPixel = fbin0_max - fbin0_min
 */
            __pyx_t_19 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
            if (__pyx_t_19) {
 404:                     #All pixel fall on 1 bins in dim 1
 405:                     aeraPixel = fbin0_max - fbin0_min
              /* "splitPixel.pyx":405
 *                 if bin1_min == bin1_max:
 *                     #All pixel fall on 1 bins in dim 1
 *                     aeraPixel = fbin0_max - fbin0_min             # <<<<<<<<<<<<<<
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaA = deltaL / aeraPixel
 */
              __pyx_v_aeraPixel = (__pyx_v_fbin0_max - __pyx_v_fbin0_min);
 406:                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
              /* "splitPixel.pyx":406
 *                     #All pixel fall on 1 bins in dim 1
 *                     aeraPixel = fbin0_max - fbin0_min
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
 *                     deltaA = deltaL / aeraPixel
 *                     outCount[bin0_min, bin1_min] += deltaA
 */
              __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 407:                     deltaA = deltaL / aeraPixel
              /* "splitPixel.pyx":407
 *                     aeraPixel = fbin0_max - fbin0_min
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaA = deltaL / aeraPixel             # <<<<<<<<<<<<<<
 *                     outCount[bin0_min, bin1_min] += deltaA
 *                     outData[bin0_min, bin1_min] += data * deltaA
 */
              __pyx_v_deltaA = (__pyx_v_deltaL / __pyx_v_aeraPixel);
 408:                     outCount[bin0_min, bin1_min] += deltaA
              /* "splitPixel.pyx":408
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaA = deltaL / aeraPixel
 *                     outCount[bin0_min, bin1_min] += deltaA             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data * deltaA
 *                     deltaR = fbin0_max - (< double > bin0_max)
 */
              __pyx_t_61 = __pyx_v_bin0_min;
              __pyx_t_62 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_61, __pyx_bstride_0_outCount, __pyx_t_62, __pyx_bstride_1_outCount) += __pyx_v_deltaA;
 409:                     outData[bin0_min, bin1_min] += data * deltaA
              /* "splitPixel.pyx":409
 *                     deltaA = deltaL / aeraPixel
 *                     outCount[bin0_min, bin1_min] += deltaA
 *                     outData[bin0_min, bin1_min] += data * deltaA             # <<<<<<<<<<<<<<
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaA = deltaR / aeraPixel
 */
              __pyx_t_67 = __pyx_v_bin0_min;
              __pyx_t_68 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_67, __pyx_bstride_0_outData, __pyx_t_68, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA);
 410:                     deltaR = fbin0_max - (< double > bin0_max)
              /* "splitPixel.pyx":410
 *                     outCount[bin0_min, bin1_min] += deltaA
 *                     outData[bin0_min, bin1_min] += data * deltaA
 *                     deltaR = fbin0_max - (< double > bin0_max)             # <<<<<<<<<<<<<<
 *                     deltaA = deltaR / aeraPixel
 *                     outCount[bin0_max, bin1_min] += deltaA
 */
              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max));
 411:                     deltaA = deltaR / aeraPixel
              /* "splitPixel.pyx":411
 *                     outData[bin0_min, bin1_min] += data * deltaA
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaA = deltaR / aeraPixel             # <<<<<<<<<<<<<<
 *                     outCount[bin0_max, bin1_min] += deltaA
 *                     outData[bin0_max, bin1_min] += data * deltaA
 */
              __pyx_v_deltaA = (__pyx_v_deltaR / __pyx_v_aeraPixel);
 412:                     outCount[bin0_max, bin1_min] += deltaA
              /* "splitPixel.pyx":412
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaA = deltaR / aeraPixel
 *                     outCount[bin0_max, bin1_min] += deltaA             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_min] += data * deltaA
 *                     deltaA = 1.0 / aeraPixel
 */
              __pyx_t_69 = __pyx_v_bin0_max;
              __pyx_t_70 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_69, __pyx_bstride_0_outCount, __pyx_t_70, __pyx_bstride_1_outCount) += __pyx_v_deltaA;
 413:                     outData[bin0_max, bin1_min] += data * deltaA
              /* "splitPixel.pyx":413
 *                     deltaA = deltaR / aeraPixel
 *                     outCount[bin0_max, bin1_min] += deltaA
 *                     outData[bin0_max, bin1_min] += data * deltaA             # <<<<<<<<<<<<<<
 *                     deltaA = 1.0 / aeraPixel
 *                     for i in range(bin0_min + 1, bin0_max):
 */
              __pyx_t_71 = __pyx_v_bin0_max;
              __pyx_t_72 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_71, __pyx_bstride_0_outData, __pyx_t_72, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA);
 414:                     deltaA = 1.0 / aeraPixel
              /* "splitPixel.pyx":414
 *                     outCount[bin0_max, bin1_min] += deltaA
 *                     outData[bin0_max, bin1_min] += data * deltaA
 *                     deltaA = 1.0 / aeraPixel             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA
 */
              __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel);
 415:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitPixel.pyx":415
 *                     outData[bin0_max, bin1_min] += data * deltaA
 *                     deltaA = 1.0 / aeraPixel
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_min] += deltaA
 *                             outData[i, bin1_min] += data * deltaA
 */
              __pyx_t_73 = __pyx_v_bin0_max;
              for (__pyx_t_74 = (__pyx_v_bin0_min + 1); __pyx_t_74 < __pyx_t_73; __pyx_t_74+=1) {
                __pyx_v_i = __pyx_t_74;
 416:                             outCount[i, bin1_min] += deltaA
                /* "splitPixel.pyx":416
 *                     deltaA = 1.0 / aeraPixel
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_min] += data * deltaA
 *                 else:
 */
                __pyx_t_75 = __pyx_v_i;
                __pyx_t_76 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_75, __pyx_bstride_0_outCount, __pyx_t_76, __pyx_bstride_1_outCount) += __pyx_v_deltaA;
 417:                             outData[i, bin1_min] += data * deltaA
                /* "splitPixel.pyx":417
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA
 *                             outData[i, bin1_min] += data * deltaA             # <<<<<<<<<<<<<<
 *                 else:
 *                     #spread on n pix in dim0 and m pixel in dim1:
 */
                __pyx_t_77 = __pyx_v_i;
                __pyx_t_78 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_77, __pyx_bstride_0_outData, __pyx_t_78, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA);
              }
              goto __pyx_L67;
            }
            /*else*/ {
 418:                 else:
 419:                     #spread on n pix in dim0 and m pixel in dim1:
 420:                     aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min)
              /* "splitPixel.pyx":420
 *                 else:
 *                     #spread on n pix in dim0 and m pixel in dim1:
 *                     aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaR = fbin0_max - (< double > bin0_max)
 */
              __pyx_v_aeraPixel = ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
 421:                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
              /* "splitPixel.pyx":421
 *                     #spread on n pix in dim0 and m pixel in dim1:
 *                     aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min)
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 */
              __pyx_v_deltaL = (((double)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 422:                     deltaR = fbin0_max - (< double > bin0_max)
              /* "splitPixel.pyx":422
 *                     aeraPixel = (fbin0_max - fbin0_min) * (fbin1_max - fbin1_min)
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaR = fbin0_max - (< double > bin0_max)             # <<<<<<<<<<<<<<
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)
 */
              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((double)__pyx_v_bin0_max));
 423:                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
              /* "splitPixel.pyx":423
 *                     deltaL = (< double > (bin0_min + 1)) - fbin0_min
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / aeraPixel
 */
              __pyx_v_deltaD = (((double)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 424:                     deltaU = fbin1_max - (< double > bin1_max)
              /* "splitPixel.pyx":424
 *                     deltaR = fbin0_max - (< double > bin0_max)
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)             # <<<<<<<<<<<<<<
 *                     deltaA = 1.0 / aeraPixel
 * 
 */
              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((double)__pyx_v_bin1_max));
 425:                     deltaA = 1.0 / aeraPixel
              /* "splitPixel.pyx":425
 *                     deltaD = (< double > (bin1_min + 1)) - fbin1_min
 *                     deltaU = fbin1_max - (< double > bin1_max)
 *                     deltaA = 1.0 / aeraPixel             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD
 */
              __pyx_v_deltaA = (1.0 / __pyx_v_aeraPixel);
 426: 
 427:                     outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD
              /* "splitPixel.pyx":427
 *                     deltaA = 1.0 / aeraPixel
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD
 * 
 */
              __pyx_t_73 = __pyx_v_bin0_min;
              __pyx_t_74 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_73, __pyx_bstride_0_outCount, __pyx_t_74, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
 428:                     outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD
              /* "splitPixel.pyx":428
 * 
 *                     outCount[bin0_min, bin1_min] += deltaA * deltaL * deltaD
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU
 */
              __pyx_t_79 = __pyx_v_bin0_min;
              __pyx_t_80 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_79, __pyx_bstride_0_outData, __pyx_t_80, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
 429: 
 430:                     outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU
              /* "splitPixel.pyx":430
 *                     outData[bin0_min, bin1_min] += data * deltaA * deltaL * deltaD
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU
 * 
 */
              __pyx_t_81 = __pyx_v_bin0_min;
              __pyx_t_82 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_81, __pyx_bstride_0_outCount, __pyx_t_82, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
 431:                     outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU
              /* "splitPixel.pyx":431
 * 
 *                     outCount[bin0_min, bin1_max] += deltaA * deltaL * deltaU
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD
 */
              __pyx_t_83 = __pyx_v_bin0_min;
              __pyx_t_84 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_83, __pyx_bstride_0_outData, __pyx_t_84, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
 432: 
 433:                     outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD
              /* "splitPixel.pyx":433
 *                     outData[bin0_min, bin1_max] += data * deltaA * deltaL * deltaU
 * 
 *                     outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD
 * 
 */
              __pyx_t_85 = __pyx_v_bin0_max;
              __pyx_t_86 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_85, __pyx_bstride_0_outCount, __pyx_t_86, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
 434:                     outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD
              /* "splitPixel.pyx":434
 * 
 *                     outCount[bin0_max, bin1_min] += deltaA * deltaR * deltaD
 *                     outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
 * 
 *                     outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU
 */
              __pyx_t_87 = __pyx_v_bin0_max;
              __pyx_t_88 = __pyx_v_bin1_min;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_87, __pyx_bstride_0_outData, __pyx_t_88, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
 435: 
 436:                     outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU
              /* "splitPixel.pyx":436
 *                     outData[bin0_max, bin1_min] += data * deltaA * deltaR * deltaD
 * 
 *                     outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
 *                     outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):
 */
              __pyx_t_89 = __pyx_v_bin0_max;
              __pyx_t_90 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_89, __pyx_bstride_0_outCount, __pyx_t_90, __pyx_bstride_1_outCount) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
 437:                     outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU
              /* "splitPixel.pyx":437
 * 
 *                     outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU
 *                     outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA * deltaD
 */
              __pyx_t_91 = __pyx_v_bin0_max;
              __pyx_t_92 = __pyx_v_bin1_max;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_91, __pyx_bstride_0_outData, __pyx_t_92, __pyx_bstride_1_outData) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
 438:                     for i in range(bin0_min + 1, bin0_max):
              /* "splitPixel.pyx":438
 *                     outCount[bin0_max, bin1_max] += deltaA * deltaR * deltaU
 *                     outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_min] += deltaA * deltaD
 *                             outData[i, bin1_min] += data * deltaA * deltaD
 */
              __pyx_t_93 = __pyx_v_bin0_max;
              for (__pyx_t_94 = (__pyx_v_bin0_min + 1); __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) {
                __pyx_v_i = __pyx_t_94;
 439:                             outCount[i, bin1_min] += deltaA * deltaD
                /* "splitPixel.pyx":439
 *                     outData[bin0_max, bin1_max] += data * deltaA * deltaR * deltaU
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA * deltaD             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_min] += data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):
 */
                __pyx_t_95 = __pyx_v_i;
                __pyx_t_96 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_95, __pyx_bstride_0_outCount, __pyx_t_96, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaD);
 440:                             outData[i, bin1_min] += data * deltaA * deltaD
                /* "splitPixel.pyx":440
 *                     for i in range(bin0_min + 1, bin0_max):
 *                             outCount[i, bin1_min] += deltaA * deltaD
 *                             outData[i, bin1_min] += data * deltaA * deltaD             # <<<<<<<<<<<<<<
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += deltaA
 */
                __pyx_t_97 = __pyx_v_i;
                __pyx_t_98 = __pyx_v_bin1_min;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_97, __pyx_bstride_0_outData, __pyx_t_98, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
 441:                             for j in range(bin1_min + 1, bin1_max):
                /* "splitPixel.pyx":441
 *                             outCount[i, bin1_min] += deltaA * deltaD
 *                             outData[i, bin1_min] += data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                                 outCount[i, j] += deltaA
 *                                 outData[i, j] += data * deltaA
 */
                __pyx_t_99 = __pyx_v_bin1_max;
                for (__pyx_t_100 = (__pyx_v_bin1_min + 1); __pyx_t_100 < __pyx_t_99; __pyx_t_100+=1) {
                  __pyx_v_j = __pyx_t_100;
 442:                                 outCount[i, j] += deltaA
                  /* "splitPixel.pyx":442
 *                             outData[i, bin1_min] += data * deltaA * deltaD
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += deltaA             # <<<<<<<<<<<<<<
 *                                 outData[i, j] += data * deltaA
 *                             outCount[i, bin1_max] += deltaA * deltaU
 */
                  __pyx_t_101 = __pyx_v_i;
                  __pyx_t_102 = __pyx_v_j;
                  *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_101, __pyx_bstride_0_outCount, __pyx_t_102, __pyx_bstride_1_outCount) += __pyx_v_deltaA;
 443:                                 outData[i, j] += data * deltaA
                  /* "splitPixel.pyx":443
 *                             for j in range(bin1_min + 1, bin1_max):
 *                                 outCount[i, j] += deltaA
 *                                 outData[i, j] += data * deltaA             # <<<<<<<<<<<<<<
 *                             outCount[i, bin1_max] += deltaA * deltaU
 *                             outData[i, bin1_max] += data * deltaA * deltaU
 */
                  __pyx_t_103 = __pyx_v_i;
                  __pyx_t_104 = __pyx_v_j;
                  *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_103, __pyx_bstride_0_outData, __pyx_t_104, __pyx_bstride_1_outData) += (__pyx_v_data * __pyx_v_deltaA);
                }
 444:                             outCount[i, bin1_max] += deltaA * deltaU
                /* "splitPixel.pyx":444
 *                                 outCount[i, j] += deltaA
 *                                 outData[i, j] += data * deltaA
 *                             outCount[i, bin1_max] += deltaA * deltaU             # <<<<<<<<<<<<<<
 *                             outData[i, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 */
                __pyx_t_99 = __pyx_v_i;
                __pyx_t_100 = __pyx_v_bin1_max;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_99, __pyx_bstride_0_outCount, __pyx_t_100, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaU);
 445:                             outData[i, bin1_max] += data * deltaA * deltaU
                /* "splitPixel.pyx":445
 *                                 outData[i, j] += data * deltaA
 *                             outCount[i, bin1_max] += deltaA * deltaU
 *                             outData[i, bin1_max] += data * deltaA * deltaU             # <<<<<<<<<<<<<<
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += deltaA * deltaL
 */
                __pyx_t_105 = __pyx_v_i;
                __pyx_t_106 = __pyx_v_bin1_max;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_105, __pyx_bstride_0_outData, __pyx_t_106, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
              }
 446:                     for j in range(bin1_min + 1, bin1_max):
              /* "splitPixel.pyx":446
 *                             outCount[i, bin1_max] += deltaA * deltaU
 *                             outData[i, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
 *                             outCount[bin0_min, j] += deltaA * deltaL
 *                             outData[bin0_min, j] += data * deltaA * deltaL
 */
              __pyx_t_93 = __pyx_v_bin1_max;
              for (__pyx_t_94 = (__pyx_v_bin1_min + 1); __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) {
                __pyx_v_j = __pyx_t_94;
 447:                             outCount[bin0_min, j] += deltaA * deltaL
                /* "splitPixel.pyx":447
 *                             outData[i, bin1_max] += data * deltaA * deltaU
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += deltaA * deltaL             # <<<<<<<<<<<<<<
 *                             outData[bin0_min, j] += data * deltaA * deltaL
 * 
 */
                __pyx_t_107 = __pyx_v_bin0_min;
                __pyx_t_108 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_107, __pyx_bstride_0_outCount, __pyx_t_108, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaL);
 448:                             outData[bin0_min, j] += data * deltaA * deltaL
                /* "splitPixel.pyx":448
 *                     for j in range(bin1_min + 1, bin1_max):
 *                             outCount[bin0_min, j] += deltaA * deltaL
 *                             outData[bin0_min, j] += data * deltaA * deltaL             # <<<<<<<<<<<<<<
 * 
 *                             outCount[bin0_max, j] += deltaA * deltaR
 */
                __pyx_t_109 = __pyx_v_bin0_min;
                __pyx_t_110 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_109, __pyx_bstride_0_outData, __pyx_t_110, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
 449: 
 450:                             outCount[bin0_max, j] += deltaA * deltaR
                /* "splitPixel.pyx":450
 *                             outData[bin0_min, j] += data * deltaA * deltaL
 * 
 *                             outCount[bin0_max, j] += deltaA * deltaR             # <<<<<<<<<<<<<<
 *                             outData[bin0_max, j] += data * deltaA * deltaR
 * 
 */
                __pyx_t_111 = __pyx_v_bin0_max;
                __pyx_t_112 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_111, __pyx_bstride_0_outCount, __pyx_t_112, __pyx_bstride_1_outCount) += (__pyx_v_deltaA * __pyx_v_deltaR);
 451:                             outData[bin0_max, j] += data * deltaA * deltaR
                /* "splitPixel.pyx":451
 * 
 *                             outCount[bin0_max, j] += deltaA * deltaR
 *                             outData[bin0_max, j] += data * deltaA * deltaR             # <<<<<<<<<<<<<<
 * 
 *     #with nogil:
 */
                __pyx_t_113 = __pyx_v_bin0_max;
                __pyx_t_114 = __pyx_v_j;
                *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_113, __pyx_bstride_0_outData, __pyx_t_114, __pyx_bstride_1_outData) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
              }
            }
            __pyx_L67:;
          }
          __pyx_L63:;
          __pyx_L27_continue:;
        }
 452: 
 453:     #with nogil:
 454:         for i in range(bins0):
        /* "splitPixel.pyx":454
 * 
 *     #with nogil:
 *         for i in range(bins0):             # <<<<<<<<<<<<<<
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:
 */
        __pyx_t_9 = __pyx_v_bins0;
        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2+=1) {
          __pyx_v_i = __pyx_t_2;
 455:             for j in range(bins1):
          /* "splitPixel.pyx":455
 *     #with nogil:
 *         for i in range(bins0):
 *             for j in range(bins1):             # <<<<<<<<<<<<<<
 *                 if outCount[i, j] > epsilon:
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 */
          __pyx_t_93 = __pyx_v_bins1;
          for (__pyx_t_94 = 0; __pyx_t_94 < __pyx_t_93; __pyx_t_94+=1) {
            __pyx_v_j = __pyx_t_94;
 456:                 if outCount[i, j] > epsilon:
            /* "splitPixel.pyx":456
 *         for i in range(bins0):
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:             # <<<<<<<<<<<<<<
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 *                 else:
 */
            __pyx_t_115 = __pyx_v_i;
            __pyx_t_116 = __pyx_v_j;
            __pyx_t_19 = ((*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_115, __pyx_bstride_0_outCount, __pyx_t_116, __pyx_bstride_1_outCount)) > __pyx_v_epsilon);
            if (__pyx_t_19) {
 457:                     outMerge[i, j] = outData[i, j] / outCount[i, j]
              /* "splitPixel.pyx":457
 *             for j in range(bins1):
 *                 if outCount[i, j] > epsilon:
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]             # <<<<<<<<<<<<<<
 *                 else:
 *                     outMerge[i, j] = dummy
 */
              __pyx_t_117 = __pyx_v_i;
              __pyx_t_118 = __pyx_v_j;
              __pyx_t_119 = __pyx_v_i;
              __pyx_t_120 = __pyx_v_j;
              __pyx_t_121 = __pyx_v_i;
              __pyx_t_122 = __pyx_v_j;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_121, __pyx_bstride_0_outMerge, __pyx_t_122, __pyx_bstride_1_outMerge) = ((*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outData.buf, __pyx_t_117, __pyx_bstride_0_outData, __pyx_t_118, __pyx_bstride_1_outData)) / (*__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outCount.buf, __pyx_t_119, __pyx_bstride_0_outCount, __pyx_t_120, __pyx_bstride_1_outCount)));
              goto __pyx_L80;
            }
            /*else*/ {
 458:                 else:
 459:                     outMerge[i, j] = dummy
              /* "splitPixel.pyx":459
 *                     outMerge[i, j] = outData[i, j] / outCount[i, j]
 *                 else:
 *                     outMerge[i, j] = dummy             # <<<<<<<<<<<<<<
 *     return outMerge.T, edges0, edges1, outData.T, outCount.T
 * 
 */
              __pyx_t_123 = __pyx_v_i;
              __pyx_t_124 = __pyx_v_j;
              *__Pyx_BufPtrStrided2d(__pyx_t_10splitPixel_DTYPE_float64_t *, __pyx_bstruct_outMerge.buf, __pyx_t_123, __pyx_bstride_0_outMerge, __pyx_t_124, __pyx_bstride_1_outMerge) = __pyx_v_dummy;
            }
            __pyx_L80:;
          }
        }
      }
 460:     return outMerge.T, edges0, edges1, outData.T, outCount.T
  /* "splitPixel.pyx":460
 *                 else:
 *                     outMerge[i, j] = dummy
 *     return outMerge.T, edges0, edges1, outData.T, outCount.T             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyTuple_New(5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_edges0));
  PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_edges0));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0));
  __Pyx_INCREF(((PyObject *)__pyx_v_edges1));
  PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_edges1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1));
  PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_12);
  __pyx_t_12 = 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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("splitPixel.fullSplit2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges0);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_edges1);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outMerge);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outCount);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cpos);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_outData);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cpos);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges0);
  __Pyx_XDECREF((PyObject *)__pyx_v_edges1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 461: 

pyfai-0.3.5/src/histogram.pyx0000644001611600065110000003250511655233014015334 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#



import cython
from cython.parallel cimport prange
cimport numpy
import numpy
cdef extern from "omp.h":
    ctypedef struct omp_lock_t:
        pass

    extern void omp_set_num_threads(int) nogil
    extern int omp_get_num_threads() nogil
    extern int omp_get_max_threads() nogil
    extern int omp_get_thread_num() nogil
    extern int omp_get_num_procs() nogil

    extern int omp_in_parallel() nogil
    extern void omp_init_lock(omp_lock_t *) nogil
    extern void omp_destroy_lock(omp_lock_t *) nogil
    extern void omp_set_lock(omp_lock_t *) nogil
    extern void omp_unset_lock(omp_lock_t *) nogil
    extern int omp_test_lock(omp_lock_t *) nogil


cdef extern from "stdlib.h":
    void free(void * ptr)nogil
    void * calloc(size_t nmemb, size_t size)nogil
    void * malloc(size_t size)nogil
cdef extern from "math.h":
    double floor(double)nogil
    double  fabs(double)nogil
    int     isnan(double)

# "ctypedef" assigns a corresponding compile-time type to DTYPE_t. For
# every type in the numpy module there's a corresponding compile-time
# type with a _t-suffix.
ctypedef numpy.int64_t DTYPE_int64_t
ctypedef numpy.float64_t DTYPE_float64_t

@cython.cdivision(True)
@cython.boundscheck(False)
@cython.wraparound(False)
def histogram(numpy.ndarray pos not None, \
              numpy.ndarray weights not None, \
              long bins=100,
              bin_range=None,
              pixelSize_in_Pos=None,
              nthread=None,
              double dummy=0.0):
    """
    Calculates histogram of pos weighted by weights
    
    @param pos: 2Theta array
    @param weights: array with intensities
    @param bins: number of output bins
    @param pixelSize_in_Pos: size of a pixels in 2theta
    @param nthread: maximum number of thread to use. By default: maximum available. 
        One can also limit this with OMP_NUM_THREADS environment variable
        
    @return 2theta, I, weighted histogram, raw histogram
    """

    assert pos.size == weights.size
    assert  bins > 1
    cdef long  size = pos.size
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos = pos.astype("float64").ravel()
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.astype("float64").ravel()
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] temp = numpy.zeros(size - 1, dtype="float64")
    cdef double bin_edge_min = pos.min()
    cdef double bin_edge_max = pos.max() * (1 + numpy.finfo(numpy.double).eps)
    if bin_range is not None:
        bin_edge_min = bin_range[0]
        bin_edge_max = bin_range[1] * (1 + numpy.finfo(numpy.double).eps)
    cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
    cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)
    cdef double a = 0.0
    cdef double d = 0.0
    cdef double fbin = 0.0
    cdef double ffbin = 0.0
    cdef double dInt = 0.0
    cdef double dIntR = 0.0
    cdef double dIntL = 0.0
    cdef double dTmp = 0.0
    cdef double dbin, inv_dbin2 = 0.0
    cdef double tmp_count, tmp_data = 0.0
    cdef double epsilon = 1e-10

    cdef long   bin = 0
    cdef long   i, idx, t, dest = 0
    if nthread is not None:
        if isinstance(nthread, int) and (nthread > 0):
            omp_set_num_threads(< int > nthread)

    cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
    cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
    if pixelSize_in_Pos is None:
        dbin = 0.5
        inv_dbin2 = 4.0
    elif isinstance(pixelSize_in_Pos, (int, float)):
        dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
        if dbin > 0.0:
            inv_dbin2 = 1 / dbin / dbin
        else:
            inv_dbin2 = 0.0
    elif isinstance(pixelSize_in_Pos, numpy.ndarray):
        pass #TODO

    if isnan(dbin) or isnan(inv_dbin2):
        dbin = 0.0
        inv_dbin2 = 0.0

    with nogil:
        for i in prange(size):
            d = cdata[i]
            a = cpos[i]
            if (a < bin_edge_min) or (a > bin_edge_max):
                continue
            fbin = (a - bin_edge_min) * inv_bin_width
            ffbin = floor(fbin)
            bin = < long > ffbin
            dest = omp_get_thread_num() * bins + bin
            dInt = 1.0
            if  bin > 0 :
                dtmp = ffbin - (fbin - dbin)
                if dtmp > 0:
                    dIntL = 0.5 * dtmp * dtmp * inv_dbin2
                    dInt = dInt - dIntL
                    bigCount[dest - 1] += dIntL
                    bigData[dest - 1] += d * dIntL

            if bin < bins - 1 :
                dtmp = fbin + dbin - ffbin - 1
                if dtmp > 0 :
                    dIntR = 0.5 * dtmp * dtmp * inv_dbin2
                    dInt = dInt - dIntR
                    bigCount[dest + 1] += dIntR
                    bigData[dest + 1] += d * dIntR
            bigCount[dest] += dInt
            bigData[dest] += d * dInt

        for idx in prange(bins):
            outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width
            tmp_count = 0.0
            tmp_data = 0.0
            for t in range(omp_get_max_threads()):
                dest = t * bins + idx
                tmp_count += bigCount[dest]
                tmp_data += bigData[dest]
            outCount[idx] += tmp_count
            outData[idx] += tmp_data
            if outCount[idx] > epsilon:
                outMerge[idx] += tmp_data / tmp_count
            else:
                outMerge[idx] += dummy

    free(bigCount)
    free(bigData)
    return  outPos, outMerge, outData, outCount


@cython.cdivision(True)
@cython.boundscheck(False)
@cython.wraparound(False)
def histogram2d(numpy.ndarray pos0 not None,
                numpy.ndarray pos1 not None,
                bins not None,
                numpy.ndarray weights not None,
                split=True,
                nthread=None,
                double dummy=0.0):
    """
    Calculate 2D histogram of pos0,pos1 weighted by weights

    @param pos0: 2Theta array
    @param pos1: Chi array
    @param weights: array with intensities
    @param bins: number of output bins int or 2-tuple of int
    @param nthread: maximum number of thread to use. By default: maximum available. 
    One can also limit this with OMP_NUM_THREADS environment variable

    
    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
    """
    assert pos0.size == pos1.size
#    if weights is not No:
    assert pos0.size == weights.size
    cdef long  bin0, bin1, i, j, b0, b1
    cdef long  size = pos0.size
    try:
        bin0, bin1 = tuple(bins)
    except:
        bin0 = bin1 = < long > bins
    if bin0 <= 0:
        bin0 = 1
    if bin1 <= 0:
        bin1 = 1
    cdef int csplit = split
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos0 = pos0.astype("float64").flatten()
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cpos1 = pos1.astype("float64").flatten()
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] data = weights.astype("float64").flatten()
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges0 = numpy.zeros(bin0, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] edges1 = numpy.zeros(bin1, dtype="float64")
    cdef double min0 = pos0.min()
    cdef double max0 = pos0.max()
    cdef double min1 = pos1.min()
    cdef double max1 = pos1.max()
    cdef double idp0 = (< double > bin0) / (max0 - min0)
    cdef double idp1 = (< double > bin1) / (max1 - min1)
    cdef double dbin0 = 0.5, dbin1 = 0.5
    cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
    if nthread is not None:
        if isinstance(nthread, int) and (nthread > 0):
            omp_set_num_threads(< int > nthread)
    with nogil:
        for i in prange(bin0):
            edges0[i] = min0 + (0.5 +< double > i) / idp0
        for i in prange(bin1):
            edges1[i] = min1 + (0.5 +< double > i) / idp1
        for i in range(size):
            p0 = cpos0[i]
            p1 = cpos1[i]
            d = data[i]
            fbin0 = (p0 - min0) * idp0
            fbin1 = (p1 - min1) * idp1
            b0 = < long > floor(fbin0)
            b1 = < long > floor(fbin1)
            if b0 == bin0:
                b0 = bin0 - 1
                fbin0 = (< double > bin0) - 0.5
            elif b0 == 0:
                fbin0 = 0.5
            if b1 == bin1:
                b1 = bin1 - 1
                fbin1 = (< double > bin1) - 0.5
            elif b1 == 0:
                fbin1 = 0.5

            delta0l = fbin0 -< double > b0 - dbin0
            delta0r = fbin0 -< double > b0 - 1 + dbin0
            delta1l = fbin1 -< double > b1 - dbin1
            delta1r = fbin1 -< double > b1 - 1 + dbin1
            rest = 1.0
            if csplit == 1:
                if delta0l < 0 and b0 > 0:
                    if delta1l < 0 and b1 > 0:
                        area = delta0l * delta1l
                        rest -= area
                        outCount[b0 - 1, b1 - 1] += area
                        outData[b0 - 1, b1 - 1] += area * d

                        area = (-delta0l) * (1 + delta1l)
                        rest -= area
                        outCount[b0 - 1, b1 ] += area
                        outData[b0 - 1, b1 ] += area * d

                        area = (1 + delta0l) * (-delta1l)
                        rest -= area
                        outCount[b0 , b1 - 1 ] += area
                        outData[b0 , b1 - 1 ] += area * d

                    elif delta1r > 0 and b1 < bin1 - 1:
                        area = -delta0l * delta1r
                        rest -= area
                        outCount[b0 - 1, b1 + 1] += area
                        outData[b0 - 1, b1 + 1] += area * d

                        area = (-delta0l) * (1 - delta1r)
                        rest -= area
                        outCount[b0 - 1, b1 ] += area
                        outData[b0 - 1, b1 ] += area * d

                        area = (1 + delta0l) * (delta1r)
                        rest -= area
                        outCount[b0 , b1 + 1 ] += area
                        outData[b0 , b1 + 1 ] += area * d
                elif delta0r > 0 and b0 < bin0 - 1:
                    if delta1l < 0 and b1 > 0:
                        area = -delta0r * delta1l
                        rest -= area
                        outCount[b0 + 1, b1 - 1] += area
                        outData[b0 + 1, b1 - 1] += area * d

                        area = (delta0r) * (1 + delta1l)
                        rest -= area
                        outCount[b0 + 1, b1 ] += area
                        outData[b0 + 1, b1 ] += area * d

                        area = (1 - delta0r) * (-delta1l)
                        rest -= area
                        outCount[b0 , b1 - 1 ] += area
                        outData[b0 , b1 - 1 ] += area * d

                    elif delta1r > 0 and b1 < bin1 - 1:
                        area = delta0r * delta1r
                        rest -= area
                        outCount[b0 + 1, b1 + 1] += area
                        outData[b0 + 1, b1 + 1] += area * d

                        area = (delta0r) * (1 - delta1r)
                        rest -= area
                        outCount[b0 + 1, b1 ] += area
                        outData[b0 + 1, b1 ] += area * d

                        area = (1 - delta0r) * (delta1r)
                        rest -= area
                        outCount[b0 , b1 + 1 ] += area
                        outData[b0 , b1 + 1 ] += area * d
            outCount[b0, b1] += rest
            outData[b0, b1] += d * rest

        for i in prange(bin0):
            for j in range(bin1):
                if outCount[i, j] > 1e-10:
                    outMerge[i, j] += outData[i, j] / outCount[i, j]
                else:
                    outMerge[i, j] += dummy


    return outMerge, edges0, edges1, outData, outCount
pyfai-0.3.5/src/relabel.html0000644001611600065110000025030311706364427015101 0ustar  kieffersoft







        

Generated by Cython 0.15.1+ on Fri Jan 20 23:22:15 2012

Raw output: relabel.c

 1: 
 2: __author__ = "Jerome Kieffer"
  /* "relabel.pyx":2
 * 
 * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":2
 * 
 * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 3: __contact__ = "Jerome.kieffer@esrf.fr"
  /* "relabel.pyx":3
 * 
 * __author__ = "Jerome Kieffer"
 * __contact__ = "Jerome.kieffer@esrf.fr"             # <<<<<<<<<<<<<<
 * __date__ = "20110923"
 * __status__ = "stable"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 4: __date__ = "20110923"
  /* "relabel.pyx":4
 * __author__ = "Jerome Kieffer"
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"             # <<<<<<<<<<<<<<
 * __status__ = "stable"
 * __license__ = "GPLv3+"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s__20110923)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 5: __status__ = "stable"
  /* "relabel.pyx":5
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 * __status__ = "stable"             # <<<<<<<<<<<<<<
 * __license__ = "GPLv3+"
 * import cython
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____status__, ((PyObject *)__pyx_n_s__stable)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 6: __license__ = "GPLv3+"
  /* "relabel.pyx":6
 * __date__ = "20110923"
 * __status__ = "stable"
 * __license__ = "GPLv3+"             # <<<<<<<<<<<<<<
 * import cython
 * cimport numpy
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_18)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 7: import cython
 8: cimport numpy
 9: import numpy
  /* "relabel.pyx":9
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __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 = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 10: 
 11: ctypedef numpy.int64_t DTYPE_int64_t
/* "relabel.pyx":11
 * import numpy
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * @cython.boundscheck(False)
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_7relabel_DTYPE_int64_t;
 12: ctypedef numpy.float64_t DTYPE_float64_t
 13: @cython.boundscheck(False)
 14: @cython.wraparound(False)
 15: def countThem(numpy.ndarray label not None, \
/* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */

static PyObject *__pyx_pf_7relabel_countThem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7relabel_countThem[] = "\n    @param label: 2D array containing labeled zones\n    @param data: 2D array containing the raw data\n    @param blured: 2D array containing the blured data\n    @return: 2D arrays containing: \n        * count pixels in labelled zone: label == index).sum() \n        * max of data in that zone:      data[label == index].max()\n        * max of blured in that zone:    blured[label == index].max()\n        * data-blured where data is max.   \n    ";
static PyMethodDef __pyx_mdef_7relabel_countThem = {__Pyx_NAMESTR("countThem"), (PyCFunction)__pyx_pf_7relabel_countThem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7relabel_countThem)};
static PyObject *__pyx_pf_7relabel_countThem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_label = 0;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_blured = 0;
  int __pyx_v_maxLabel;
  PyArrayObject *__pyx_v_clabel = 0;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_cblured = 0;
  PyArrayObject *__pyx_v_count = 0;
  PyArrayObject *__pyx_v_maxData = 0;
  PyArrayObject *__pyx_v_maxBlured = 0;
  PyArrayObject *__pyx_v_maxDelta = 0;
  long __pyx_v_s;
  long __pyx_v_i;
  long __pyx_v_idx;
  double __pyx_v_d;
  double __pyx_v_b;
  Py_buffer __pyx_bstruct_count;
  Py_ssize_t __pyx_bstride_0_count = 0;
  Py_ssize_t __pyx_bshape_0_count = 0;
  Py_buffer __pyx_bstruct_maxData;
  Py_ssize_t __pyx_bstride_0_maxData = 0;
  Py_ssize_t __pyx_bshape_0_maxData = 0;
  Py_buffer __pyx_bstruct_maxDelta;
  Py_ssize_t __pyx_bstride_0_maxDelta = 0;
  Py_ssize_t __pyx_bshape_0_maxDelta = 0;
  Py_buffer __pyx_bstruct_maxBlured;
  Py_ssize_t __pyx_bstride_0_maxBlured = 0;
  Py_ssize_t __pyx_bshape_0_maxBlured = 0;
  Py_buffer __pyx_bstruct_cdata;
  Py_ssize_t __pyx_bstride_0_cdata = 0;
  Py_ssize_t __pyx_bshape_0_cdata = 0;
  Py_buffer __pyx_bstruct_cblured;
  Py_ssize_t __pyx_bstride_0_cblured = 0;
  Py_ssize_t __pyx_bshape_0_cblured = 0;
  Py_buffer __pyx_bstruct_clabel;
  Py_ssize_t __pyx_bstride_0_clabel = 0;
  Py_ssize_t __pyx_bshape_0_clabel = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__label,&__pyx_n_s__data,&__pyx_n_s__blured,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countThem");
  __pyx_self = __pyx_self;
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blured);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "countThem") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_label = ((PyArrayObject *)values[0]);
    __pyx_v_data = ((PyArrayObject *)values[1]);
    __pyx_v_blured = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("relabel.countThem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_clabel.buf = NULL;
  __pyx_bstruct_cdata.buf = NULL;
  __pyx_bstruct_cblured.buf = NULL;
  __pyx_bstruct_count.buf = NULL;
  __pyx_bstruct_maxData.buf = NULL;
  __pyx_bstruct_maxBlured.buf = NULL;
  __pyx_bstruct_maxDelta.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 0, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_blured), __pyx_ptype_5numpy_ndarray, 0, "blured", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */
  __pyx_k_tuple_19 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__label));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__label));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__blured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__blured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxLabel));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__maxLabel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxLabel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__clabel));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__clabel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clabel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cblured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__cblured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cblured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxData));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__maxData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxBlured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__maxBlured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxBlured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxDelta));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__maxDelta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxDelta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__s));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__d));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7relabel_countThem, NULL, __pyx_n_s__relabel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__countThem, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 16:               numpy.ndarray data not None, \
 17:               numpy.ndarray blured not None):
 18:     """
 19:     @param label: 2D array containing labeled zones
 20:     @param data: 2D array containing the raw data
 21:     @param blured: 2D array containing the blured data
 22:     @return: 2D arrays containing:
 23:         * count pixels in labelled zone: label == index).sum()
 24:         * max of data in that zone:      data[label == index].max()
 25:         * max of blured in that zone:    blured[label == index].max()
 26:         * data-blured where data is max.
 27:     """
 28:     cdef int maxLabel = label.max()
  /* "relabel.pyx":28
 *         * data-blured where data is max.
 *     """
 *     cdef int maxLabel = label.max()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__max); 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);
  __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 = 28; __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_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_maxLabel = __pyx_t_3;
 29:     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
  /* "relabel.pyx":29
 *     """
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_clabel, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_clabel = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_clabel.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_clabel = __pyx_bstruct_clabel.strides[0];
      __pyx_bshape_0_clabel = __pyx_bstruct_clabel.shape[0];
    }
  }
  __pyx_t_4 = 0;
  __pyx_v_clabel = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "relabel.pyx":29
 *     """
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__int64));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__int64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 30:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
  /* "relabel.pyx":30
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0];
      __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "relabel.pyx":30
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 31:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
  /* "relabel.pyx":31
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_blured), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cblured, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cblured = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cblured.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cblured = __pyx_bstruct_cblured.strides[0];
      __pyx_bshape_0_cblured = __pyx_bstruct_cblured.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_cblured = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "relabel.pyx":31
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 32:     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
  /* "relabel.pyx":32
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong((__pyx_v_maxLabel + 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);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__int64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_count, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_count = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_count.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_count = __pyx_bstruct_count.strides[0];
      __pyx_bshape_0_count = __pyx_bstruct_count.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_count = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;
 33:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
  /* "relabel.pyx":33
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); 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);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromLong((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxData, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxData = __pyx_bstruct_maxData.strides[0];
      __pyx_bshape_0_maxData = __pyx_bstruct_maxData.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_maxData = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
 34:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
  /* "relabel.pyx":34
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef long s , i, idx
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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__float64); 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;
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); 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_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxBlured, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxBlured = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxBlured.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxBlured = __pyx_bstruct_maxBlured.strides[0];
      __pyx_bshape_0_maxBlured = __pyx_bstruct_maxBlured.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_maxBlured = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 35:     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
  /* "relabel.pyx":35
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef long s , i, idx
 *     cdef double d, b
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong((__pyx_v_maxLabel + 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); 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_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __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_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxDelta, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxDelta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxDelta.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxDelta = __pyx_bstruct_maxDelta.strides[0];
      __pyx_bshape_0_maxDelta = __pyx_bstruct_maxDelta.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_maxDelta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 36:     cdef long s , i, idx
 37:     cdef double d, b
 38:     s = < long > label.size
  /* "relabel.pyx":38
 *     cdef long s , i, idx
 *     cdef double d, b
 *     s = < long > label.size             # <<<<<<<<<<<<<<
 *     assert s == cdata.size
 *     assert s == cblured.size
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = ((long)__pyx_t_14);
 39:     assert s == cdata.size
  /* "relabel.pyx":39
 *     cdef double d, b
 *     s = < long > label.size
 *     assert s == cdata.size             # <<<<<<<<<<<<<<
 *     assert s == cblured.size
 *     for i in range(s):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_cdata), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_15)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 40:     assert s == cblured.size
  /* "relabel.pyx":40
 *     s = < long > label.size
 *     assert s == cdata.size
 *     assert s == cblured.size             # <<<<<<<<<<<<<<
 *     for i in range(s):
 *         idx = < long > clabel[i]
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_7 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_cblured), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_15)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif
 41:     for i in range(s):
  /* "relabel.pyx":41
 *     assert s == cdata.size
 *     assert s == cblured.size
 *     for i in range(s):             # <<<<<<<<<<<<<<
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]
 */
  __pyx_t_14 = __pyx_v_s;
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) {
    __pyx_v_i = __pyx_t_16;
 42:         idx = < long > clabel[i]
    /* "relabel.pyx":42
 *     assert s == cblured.size
 *     for i in range(s):
 *         idx = < long > clabel[i]             # <<<<<<<<<<<<<<
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]
 */
    __pyx_t_17 = __pyx_v_i;
    __pyx_v_idx = ((long)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_int64_t *, __pyx_bstruct_clabel.buf, __pyx_t_17, __pyx_bstride_0_clabel)));
 43:         d = < double > cdata[i]
    /* "relabel.pyx":43
 *     for i in range(s):
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]             # <<<<<<<<<<<<<<
 *         b = < double > cblured[i]
 *         count[idx] += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_v_d = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_18, __pyx_bstride_0_cdata)));
 44:         b = < double > cblured[i]
    /* "relabel.pyx":44
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]             # <<<<<<<<<<<<<<
 *         count[idx] += 1
 *         if d > maxData[idx]:
 */
    __pyx_t_19 = __pyx_v_i;
    __pyx_v_b = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_cblured.buf, __pyx_t_19, __pyx_bstride_0_cblured)));
 45:         count[idx] += 1
    /* "relabel.pyx":45
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]
 *         count[idx] += 1             # <<<<<<<<<<<<<<
 *         if d > maxData[idx]:
 *             maxData[idx] = d
 */
    __pyx_t_20 = __pyx_v_idx;
    *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_int64_t *, __pyx_bstruct_count.buf, __pyx_t_20, __pyx_bstride_0_count) += 1;
 46:         if d > maxData[idx]:
    /* "relabel.pyx":46
 *         b = < double > cblured[i]
 *         count[idx] += 1
 *         if d > maxData[idx]:             # <<<<<<<<<<<<<<
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b
 */
    __pyx_t_21 = __pyx_v_idx;
    __pyx_t_15 = (__pyx_v_d > (*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxData.buf, __pyx_t_21, __pyx_bstride_0_maxData)));
    if (__pyx_t_15) {
 47:             maxData[idx] = d
      /* "relabel.pyx":47
 *         count[idx] += 1
 *         if d > maxData[idx]:
 *             maxData[idx] = d             # <<<<<<<<<<<<<<
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:
 */
      __pyx_t_22 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxData.buf, __pyx_t_22, __pyx_bstride_0_maxData) = __pyx_v_d;
 48:             maxDelta[idx] = d - b
      /* "relabel.pyx":48
 *         if d > maxData[idx]:
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b             # <<<<<<<<<<<<<<
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b
 */
      __pyx_t_23 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxDelta.buf, __pyx_t_23, __pyx_bstride_0_maxDelta) = (__pyx_v_d - __pyx_v_b);
      goto __pyx_L8;
    }
    __pyx_L8:;
 49:         if b > maxBlured[idx]:
    /* "relabel.pyx":49
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:             # <<<<<<<<<<<<<<
 *             maxBlured[idx] = b
 *     return count, maxData, maxBlured, maxDelta
 */
    __pyx_t_24 = __pyx_v_idx;
    __pyx_t_15 = (__pyx_v_b > (*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxBlured.buf, __pyx_t_24, __pyx_bstride_0_maxBlured)));
    if (__pyx_t_15) {
 50:             maxBlured[idx] = b
      /* "relabel.pyx":50
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b             # <<<<<<<<<<<<<<
 *     return count, maxData, maxBlured, maxDelta
 * 
 */
      __pyx_t_25 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxBlured.buf, __pyx_t_25, __pyx_bstride_0_maxBlured) = __pyx_v_b;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
 51:     return count, maxData, maxBlured, maxDelta
  /* "relabel.pyx":51
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b
 *     return count, maxData, maxBlured, maxDelta             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_count));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_count));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxData));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_maxData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxData));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxBlured));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_maxBlured));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxBlured));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxDelta));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_maxDelta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxDelta));
  __pyx_r = ((PyObject *)__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_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxData);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxDelta);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxBlured);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cblured);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_clabel);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("relabel.countThem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxData);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxDelta);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxBlured);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cblured);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_clabel);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_clabel);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_cblured);
  __Pyx_XDECREF((PyObject *)__pyx_v_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxData);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxBlured);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxDelta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 52: 
 53: 
 54: 

pyfai-0.3.5/src/xutils.pyx0000644001611600065110000001051011640377271014667 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

import cython
cimport numpy
import numpy

ctypedef numpy.int64_t DTYPE_int64_t
ctypedef numpy.float64_t DTYPE_float64_t

def boundingBox(data):
    """
    Calculate bounding box around   

    @param img: 2D array like
    @return: 4-typle (d0_min, d1_min, d0_max, d1_max)
    
    
    NOTA: Does not work :( 
     
    """
    cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape)
    cdef long ndims = data.ndim

#    cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float)
    cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape)
    cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int)


    cdef long  i = 0
    cdef long  j = 0
    cdef long  k = 0
    cdef long  l = 0
#    cdef DTYPE_float64_t x = 0.0
#    cdef DTYPE_float64_t zero64 = 0.0
    if ndims == 1:
#        with nogil:
            for i in range(shape[0]):
                if data[i] > 0.0:
                    if i < mins[0]:
                        mins[0] = i
                    if i > maxs[0]:
                        maxs[0] = i
    elif ndims == 2:
#        with nogil:
            for i in range(shape[0]):
                for j in range(shape[1]):
                    if data[i, j] > 0.0 :
                        if i < mins[0]:
                            mins[0] = i
                        if i > maxs[0]:
                            maxs[0] = i
                        if j < mins[1]:
                            mins[1] = i
                        if j > maxs[1]:
                            maxs[1] = i
    elif ndims == 3:
#        with nogil:
            for i in range(shape[0]):
                for j in range(shape[1]):
                    for k in range(shape[2]):
                        if  data[i, j, k] > 0.0:
                            if i < mins[0]:
                                mins[0] = i
                            if i > maxs[0]:
                                maxs[0] = i
                            if j < mins[1]:
                                mins[1] = i
                            if j > maxs[1]:
                                maxs[1] = i
                            if k < mins[2]:
                                mins[2] = i
                            if k > maxs[2]:
                                maxs[2] = i
    elif ndims == 4:
#        with nogil:
            for i in range(shape[0]):
                for j in range(shape[1]):
                    for k in range(shape[2]):
                        for l in range(shape[3]):
                            if  data[i, j, k, l] > 0.0:
                                if i < mins[0]:
                                    mins[0] = i
                                if i > maxs[0]:
                                    maxs[0] = i
                                if j < mins[1]:
                                    mins[1] = i
                                if j > maxs[1]:
                                    maxs[1] = i
                                if k < mins[2]:
                                    mins[2] = i
                                if k > maxs[2]:
                                    maxs[2] = i
                                if l < mins[3]:
                                    mins[3] = i
                                if l > maxs[3]:
                                    maxs[3] = i
    else:
        raise RuntimeError("Dimensions > 4 not implemented")
    return tuple(mins) + tuple(maxs)

pyfai-0.3.5/src/xutils.html0000644001611600065110000041112411645660757015032 0ustar  kieffersoft







        

Generated by Cython 0.15.1+ on Fri Oct 14 00:10:55 2011

Raw output: xutils.c

 1: #!/usr/bin/env python
  /* "xutils.pyx":1
 * #!/usr/bin/env python             # <<<<<<<<<<<<<<
 * # -*- coding: utf8 -*-
 * #
 */
  __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: utf8 -*-
 3: #
 4: #    Project: Azimuthal integration
 5: #             https://forge.epn-campus.eu/projects/azimuthal
 6: #
 7: #    File: "$Id$"
 8: #
 9: #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
 10: #
 11: #    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
 12: #
 13: #    This program is free software: you can redistribute it and/or modify
 14: #    it under the terms of the GNU General Public License as published by
 15: #    the Free Software Foundation, either version 3 of the License, or
 16: #    (at your option) any later version.
 17: #
 18: #    This program is distributed in the hope that it will be useful,
 19: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21: #    GNU General Public License for more details.
 22: #
 23: #    You should have received a copy of the GNU General Public License
 24: #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 25: #
 26: 
 27: import cython
 28: cimport numpy
 29: import numpy
  /* "xutils.pyx":29
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 30: 
 31: ctypedef numpy.int64_t DTYPE_int64_t
/* "xutils.pyx":31
 * import numpy
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_6xutils_DTYPE_int64_t;
 32: ctypedef numpy.float64_t DTYPE_float64_t
 33: 
 34: def boundingBox(data):
/* "xutils.pyx":34
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 * def boundingBox(data):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate bounding box around
 */

static PyObject *__pyx_pf_6xutils_boundingBox(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_6xutils_boundingBox[] = "\n    Calculate bounding box around   \n\n    @param img: 2D array like\n    @return: 4-typle (d0_min, d1_min, d0_max, d1_max)\n    \n    \n    NOTA: Does not work :( \n     \n    ";
static PyMethodDef __pyx_mdef_6xutils_boundingBox = {__Pyx_NAMESTR("boundingBox"), (PyCFunction)__pyx_pf_6xutils_boundingBox, METH_O, __Pyx_DOCSTR(__pyx_doc_6xutils_boundingBox)};
static PyObject *__pyx_pf_6xutils_boundingBox(PyObject *__pyx_self, PyObject *__pyx_v_data) {
  PyArrayObject *__pyx_v_shape = 0;
  long __pyx_v_ndims;
  PyArrayObject *__pyx_v_mins = 0;
  PyArrayObject *__pyx_v_maxs = 0;
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_v_k;
  long __pyx_v_l;
  Py_buffer __pyx_bstruct_maxs;
  Py_ssize_t __pyx_bstride_0_maxs = 0;
  Py_ssize_t __pyx_bshape_0_maxs = 0;
  Py_buffer __pyx_bstruct_shape;
  Py_ssize_t __pyx_bstride_0_shape = 0;
  Py_ssize_t __pyx_bshape_0_shape = 0;
  Py_buffer __pyx_bstruct_mins;
  Py_ssize_t __pyx_bstride_0_mins = 0;
  Py_ssize_t __pyx_bshape_0_mins = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boundingBox");
  __pyx_self = __pyx_self;
  __pyx_bstruct_shape.buf = NULL;
  __pyx_bstruct_mins.buf = NULL;
  __pyx_bstruct_maxs.buf = NULL;

  /* "xutils.pyx":34
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 * def boundingBox(data):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate bounding box around
 */
  __pyx_k_tuple_15 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__shape));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ndims));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__ndims));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndims));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mins));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__mins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxs));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__maxs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((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_15, 6, ((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_15, 7, ((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_15, 8, ((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));

  /* "xutils.pyx":34
 * ctypedef numpy.float64_t DTYPE_float64_t
 * 
 * def boundingBox(data):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate bounding box around
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6xutils_boundingBox, NULL, __pyx_n_s__xutils); 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);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__boundingBox, __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;
 35:     """
 36:     Calculate bounding box around
 37: 
 38:     @param img: 2D array like
 39:     @return: 4-typle (d0_min, d1_min, d0_max, d1_max)
 40: 
 41: 
 42:     NOTA: Does not work :(
 43: 
 44:     """
 45:     cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape)
  /* "xutils.pyx":45
 * 
 *     """
 *     cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape)             # <<<<<<<<<<<<<<
 *     cdef long ndims = data.ndim
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shape, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_shape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_shape.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_shape = __pyx_bstruct_shape.strides[0];
      __pyx_bshape_0_shape = __pyx_bstruct_shape.shape[0];
    }
  }
  __pyx_t_4 = 0;
  __pyx_v_shape = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 46:     cdef long ndims = data.ndim
  /* "xutils.pyx":46
 *     """
 *     cdef numpy.ndarray[long, ndim = 1] shape = numpy.array(data.shape)
 *     cdef long ndims = data.ndim             # <<<<<<<<<<<<<<
 * 
 * #    cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ndims = __pyx_t_5;
 47: 
 48: #    cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float)
 49:     cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape)
  /* "xutils.pyx":49
 * 
 * #    cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float)
 *     cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_shape));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_shape));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mins, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_mins = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_mins.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_mins = __pyx_bstruct_mins.strides[0];
      __pyx_bshape_0_mins = __pyx_bstruct_mins.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_mins = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 50:     cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int)
  /* "xutils.pyx":50
 * #    cdef numpy.ndarray[float, ndim = ndims] fdata = data.astype(float)
 *     cdef numpy.ndarray[long, ndim = 1] mins = numpy.array(shape)
 *     cdef numpy.ndarray[long, ndim = 1] maxs = numpy.zeros(ndims, dtype=int)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_ndims); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxs, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxs.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxs = __pyx_bstruct_maxs.strides[0];
      __pyx_bshape_0_maxs = __pyx_bstruct_maxs.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_maxs = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;
 51: 
 52: 
 53:     cdef long  i = 0
  /* "xutils.pyx":53
 * 
 * 
 *     cdef long  i = 0             # <<<<<<<<<<<<<<
 *     cdef long  j = 0
 *     cdef long  k = 0
 */
  __pyx_v_i = 0;
 54:     cdef long  j = 0
  /* "xutils.pyx":54
 * 
 *     cdef long  i = 0
 *     cdef long  j = 0             # <<<<<<<<<<<<<<
 *     cdef long  k = 0
 *     cdef long  l = 0
 */
  __pyx_v_j = 0;
 55:     cdef long  k = 0
  /* "xutils.pyx":55
 *     cdef long  i = 0
 *     cdef long  j = 0
 *     cdef long  k = 0             # <<<<<<<<<<<<<<
 *     cdef long  l = 0
 * #    cdef DTYPE_float64_t x = 0.0
 */
  __pyx_v_k = 0;
 56:     cdef long  l = 0
  /* "xutils.pyx":56
 *     cdef long  j = 0
 *     cdef long  k = 0
 *     cdef long  l = 0             # <<<<<<<<<<<<<<
 * #    cdef DTYPE_float64_t x = 0.0
 * #    cdef DTYPE_float64_t zero64 = 0.0
 */
  __pyx_v_l = 0;
 57: #    cdef DTYPE_float64_t x = 0.0
 58: #    cdef DTYPE_float64_t zero64 = 0.0
 59:     if ndims == 1:
    /* "xutils.pyx":59
 * #    cdef DTYPE_float64_t x = 0.0
 * #    cdef DTYPE_float64_t zero64 = 0.0
 *     if ndims == 1:             # <<<<<<<<<<<<<<
 * #        with nogil:
 *             for i in range(shape[0]):
 */
    case 1:
 60: #        with nogil:
 61:             for i in range(shape[0]):
    /* "xutils.pyx":61
 *     if ndims == 1:
 * #        with nogil:
 *             for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *                 if data[i] > 0.0:
 *                     if i < mins[0]:
 */
    __pyx_t_5 = 0;
    __pyx_t_9 = -1;
    if (__pyx_t_5 < 0) {
      __pyx_t_5 += __pyx_bshape_0_shape;
      if (unlikely(__pyx_t_5 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_10 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_5, __pyx_bstride_0_shape));
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;
 62:                 if data[i] > 0.0:
      /* "xutils.pyx":62
 * #        with nogil:
 *             for i in range(shape[0]):
 *                 if data[i] > 0.0:             # <<<<<<<<<<<<<<
 *                     if i < mins[0]:
 *                         mins[0] = i
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_12) {
 63:                     if i < mins[0]:
        /* "xutils.pyx":63
 *             for i in range(shape[0]):
 *                 if data[i] > 0.0:
 *                     if i < mins[0]:             # <<<<<<<<<<<<<<
 *                         mins[0] = i
 *                     if i > maxs[0]:
 */
        __pyx_t_13 = 0;
        __pyx_t_9 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_bshape_0_mins;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
        if (unlikely(__pyx_t_9 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_9);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_13, __pyx_bstride_0_mins)));
        if (__pyx_t_12) {
 64:                         mins[0] = i
          /* "xutils.pyx":64
 *                 if data[i] > 0.0:
 *                     if i < mins[0]:
 *                         mins[0] = i             # <<<<<<<<<<<<<<
 *                     if i > maxs[0]:
 *                         maxs[0] = i
 */
          __pyx_t_14 = 0;
          __pyx_t_9 = -1;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_bshape_0_mins;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_14, __pyx_bstride_0_mins) = __pyx_v_i;
          goto __pyx_L8;
        }
        __pyx_L8:;
 65:                     if i > maxs[0]:
        /* "xutils.pyx":65
 *                     if i < mins[0]:
 *                         mins[0] = i
 *                     if i > maxs[0]:             # <<<<<<<<<<<<<<
 *                         maxs[0] = i
 *     elif ndims == 2:
 */
        __pyx_t_15 = 0;
        __pyx_t_9 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_bshape_0_maxs;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
        if (unlikely(__pyx_t_9 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_9);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_15, __pyx_bstride_0_maxs)));
        if (__pyx_t_12) {
 66:                         maxs[0] = i
          /* "xutils.pyx":66
 *                         mins[0] = i
 *                     if i > maxs[0]:
 *                         maxs[0] = i             # <<<<<<<<<<<<<<
 *     elif ndims == 2:
 * #        with nogil:
 */
          __pyx_t_16 = 0;
          __pyx_t_9 = -1;
          if (__pyx_t_16 < 0) {
            __pyx_t_16 += __pyx_bshape_0_maxs;
            if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_16, __pyx_bstride_0_maxs) = __pyx_v_i;
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    break;
 67:     elif ndims == 2:
    /* "xutils.pyx":67
 *                     if i > maxs[0]:
 *                         maxs[0] = i
 *     elif ndims == 2:             # <<<<<<<<<<<<<<
 * #        with nogil:
 *             for i in range(shape[0]):
 */
    case 2:
 68: #        with nogil:
 69:             for i in range(shape[0]):
    /* "xutils.pyx":69
 *     elif ndims == 2:
 * #        with nogil:
 *             for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *                 for j in range(shape[1]):
 *                     if data[i, j] > 0.0 :
 */
    __pyx_t_10 = 0;
    __pyx_t_9 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_11 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_10, __pyx_bstride_0_shape));
    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_11; __pyx_t_17+=1) {
      __pyx_v_i = __pyx_t_17;
 70:                 for j in range(shape[1]):
      /* "xutils.pyx":70
 * #        with nogil:
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):             # <<<<<<<<<<<<<<
 *                     if data[i, j] > 0.0 :
 *                         if i < mins[0]:
 */
      __pyx_t_18 = 1;
      __pyx_t_9 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_bshape_0_shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
      if (unlikely(__pyx_t_9 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_9);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_19 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_18, __pyx_bstride_0_shape));
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;
 71:                     if data[i, j] > 0.0 :
        /* "xutils.pyx":71
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):
 *                     if data[i, j] > 0.0 :             # <<<<<<<<<<<<<<
 *                         if i < mins[0]:
 *                             mins[0] = i
 */
        __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_3 = 0;
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_7)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __pyx_t_7 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_12) {
 72:                         if i < mins[0]:
          /* "xutils.pyx":72
 *                 for j in range(shape[1]):
 *                     if data[i, j] > 0.0 :
 *                         if i < mins[0]:             # <<<<<<<<<<<<<<
 *                             mins[0] = i
 *                         if i > maxs[0]:
 */
          __pyx_t_21 = 0;
          __pyx_t_9 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_bshape_0_mins;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_21, __pyx_bstride_0_mins)));
          if (__pyx_t_12) {
 73:                             mins[0] = i
            /* "xutils.pyx":73
 *                     if data[i, j] > 0.0 :
 *                         if i < mins[0]:
 *                             mins[0] = i             # <<<<<<<<<<<<<<
 *                         if i > maxs[0]:
 *                             maxs[0] = i
 */
            __pyx_t_22 = 0;
            __pyx_t_9 = -1;
            if (__pyx_t_22 < 0) {
              __pyx_t_22 += __pyx_bshape_0_mins;
              if (unlikely(__pyx_t_22 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_22, __pyx_bstride_0_mins) = __pyx_v_i;
            goto __pyx_L15;
          }
          __pyx_L15:;
 74:                         if i > maxs[0]:
          /* "xutils.pyx":74
 *                         if i < mins[0]:
 *                             mins[0] = i
 *                         if i > maxs[0]:             # <<<<<<<<<<<<<<
 *                             maxs[0] = i
 *                         if j < mins[1]:
 */
          __pyx_t_23 = 0;
          __pyx_t_9 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_bshape_0_maxs;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_23, __pyx_bstride_0_maxs)));
          if (__pyx_t_12) {
 75:                             maxs[0] = i
            /* "xutils.pyx":75
 *                             mins[0] = i
 *                         if i > maxs[0]:
 *                             maxs[0] = i             # <<<<<<<<<<<<<<
 *                         if j < mins[1]:
 *                             mins[1] = i
 */
            __pyx_t_24 = 0;
            __pyx_t_9 = -1;
            if (__pyx_t_24 < 0) {
              __pyx_t_24 += __pyx_bshape_0_maxs;
              if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_24, __pyx_bstride_0_maxs) = __pyx_v_i;
            goto __pyx_L16;
          }
          __pyx_L16:;
 76:                         if j < mins[1]:
          /* "xutils.pyx":76
 *                         if i > maxs[0]:
 *                             maxs[0] = i
 *                         if j < mins[1]:             # <<<<<<<<<<<<<<
 *                             mins[1] = i
 *                         if j > maxs[1]:
 */
          __pyx_t_25 = 1;
          __pyx_t_9 = -1;
          if (__pyx_t_25 < 0) {
            __pyx_t_25 += __pyx_bshape_0_mins;
            if (unlikely(__pyx_t_25 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_25, __pyx_bstride_0_mins)));
          if (__pyx_t_12) {
 77:                             mins[1] = i
            /* "xutils.pyx":77
 *                             maxs[0] = i
 *                         if j < mins[1]:
 *                             mins[1] = i             # <<<<<<<<<<<<<<
 *                         if j > maxs[1]:
 *                             maxs[1] = i
 */
            __pyx_t_26 = 1;
            __pyx_t_9 = -1;
            if (__pyx_t_26 < 0) {
              __pyx_t_26 += __pyx_bshape_0_mins;
              if (unlikely(__pyx_t_26 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_26, __pyx_bstride_0_mins) = __pyx_v_i;
            goto __pyx_L17;
          }
          __pyx_L17:;
 78:                         if j > maxs[1]:
          /* "xutils.pyx":78
 *                         if j < mins[1]:
 *                             mins[1] = i
 *                         if j > maxs[1]:             # <<<<<<<<<<<<<<
 *                             maxs[1] = i
 *     elif ndims == 3:
 */
          __pyx_t_27 = 1;
          __pyx_t_9 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_bshape_0_maxs;
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_27, __pyx_bstride_0_maxs)));
          if (__pyx_t_12) {
 79:                             maxs[1] = i
            /* "xutils.pyx":79
 *                             mins[1] = i
 *                         if j > maxs[1]:
 *                             maxs[1] = i             # <<<<<<<<<<<<<<
 *     elif ndims == 3:
 * #        with nogil:
 */
            __pyx_t_28 = 1;
            __pyx_t_9 = -1;
            if (__pyx_t_28 < 0) {
              __pyx_t_28 += __pyx_bshape_0_maxs;
              if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_28, __pyx_bstride_0_maxs) = __pyx_v_i;
            goto __pyx_L18;
          }
          __pyx_L18:;
          goto __pyx_L14;
        }
        __pyx_L14:;
      }
    }
    break;
 80:     elif ndims == 3:
    /* "xutils.pyx":80
 *                         if j > maxs[1]:
 *                             maxs[1] = i
 *     elif ndims == 3:             # <<<<<<<<<<<<<<
 * #        with nogil:
 *             for i in range(shape[0]):
 */
    case 3:
 81: #        with nogil:
 82:             for i in range(shape[0]):
    /* "xutils.pyx":82
 *     elif ndims == 3:
 * #        with nogil:
 *             for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):
 */
    __pyx_t_11 = 0;
    __pyx_t_9 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_0_shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_17 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_11, __pyx_bstride_0_shape));
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) {
      __pyx_v_i = __pyx_t_19;
 83:                 for j in range(shape[1]):
      /* "xutils.pyx":83
 * #        with nogil:
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):             # <<<<<<<<<<<<<<
 *                     for k in range(shape[2]):
 *                         if  data[i, j, k] > 0.0:
 */
      __pyx_t_20 = 1;
      __pyx_t_9 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_bshape_0_shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
      if (unlikely(__pyx_t_9 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_9);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_29 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_20, __pyx_bstride_0_shape));
      for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
        __pyx_v_j = __pyx_t_30;
 84:                     for k in range(shape[2]):
        /* "xutils.pyx":84
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):             # <<<<<<<<<<<<<<
 *                         if  data[i, j, k] > 0.0:
 *                             if i < mins[0]:
 */
        __pyx_t_31 = 2;
        __pyx_t_9 = -1;
        if (__pyx_t_31 < 0) {
          __pyx_t_31 += __pyx_bshape_0_shape;
          if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0;
        } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
        if (unlikely(__pyx_t_9 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_9);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_32 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_31, __pyx_bstride_0_shape));
        for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
          __pyx_v_k = __pyx_t_33;
 85:                         if  data[i, j, k] > 0.0:
          /* "xutils.pyx":85
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):
 *                         if  data[i, j, k] > 0.0:             # <<<<<<<<<<<<<<
 *                             if i < mins[0]:
 *                                 mins[0] = i
 */
          __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_3 = 0;
          __pyx_t_7 = 0;
          __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __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 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_12) {
 86:                             if i < mins[0]:
            /* "xutils.pyx":86
 *                     for k in range(shape[2]):
 *                         if  data[i, j, k] > 0.0:
 *                             if i < mins[0]:             # <<<<<<<<<<<<<<
 *                                 mins[0] = i
 *                             if i > maxs[0]:
 */
            __pyx_t_34 = 0;
            __pyx_t_9 = -1;
            if (__pyx_t_34 < 0) {
              __pyx_t_34 += __pyx_bshape_0_mins;
              if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_34 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_34, __pyx_bstride_0_mins)));
            if (__pyx_t_12) {
 87:                                 mins[0] = i
              /* "xutils.pyx":87
 *                         if  data[i, j, k] > 0.0:
 *                             if i < mins[0]:
 *                                 mins[0] = i             # <<<<<<<<<<<<<<
 *                             if i > maxs[0]:
 *                                 maxs[0] = i
 */
              __pyx_t_35 = 0;
              __pyx_t_9 = -1;
              if (__pyx_t_35 < 0) {
                __pyx_t_35 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_35 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_35, __pyx_bstride_0_mins) = __pyx_v_i;
              goto __pyx_L26;
            }
            __pyx_L26:;
 88:                             if i > maxs[0]:
            /* "xutils.pyx":88
 *                             if i < mins[0]:
 *                                 mins[0] = i
 *                             if i > maxs[0]:             # <<<<<<<<<<<<<<
 *                                 maxs[0] = i
 *                             if j < mins[1]:
 */
            __pyx_t_36 = 0;
            __pyx_t_9 = -1;
            if (__pyx_t_36 < 0) {
              __pyx_t_36 += __pyx_bshape_0_maxs;
              if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_36, __pyx_bstride_0_maxs)));
            if (__pyx_t_12) {
 89:                                 maxs[0] = i
              /* "xutils.pyx":89
 *                                 mins[0] = i
 *                             if i > maxs[0]:
 *                                 maxs[0] = i             # <<<<<<<<<<<<<<
 *                             if j < mins[1]:
 *                                 mins[1] = i
 */
              __pyx_t_37 = 0;
              __pyx_t_9 = -1;
              if (__pyx_t_37 < 0) {
                __pyx_t_37 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_37 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_37, __pyx_bstride_0_maxs) = __pyx_v_i;
              goto __pyx_L27;
            }
            __pyx_L27:;
 90:                             if j < mins[1]:
            /* "xutils.pyx":90
 *                             if i > maxs[0]:
 *                                 maxs[0] = i
 *                             if j < mins[1]:             # <<<<<<<<<<<<<<
 *                                 mins[1] = i
 *                             if j > maxs[1]:
 */
            __pyx_t_38 = 1;
            __pyx_t_9 = -1;
            if (__pyx_t_38 < 0) {
              __pyx_t_38 += __pyx_bshape_0_mins;
              if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_38 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_38, __pyx_bstride_0_mins)));
            if (__pyx_t_12) {
 91:                                 mins[1] = i
              /* "xutils.pyx":91
 *                                 maxs[0] = i
 *                             if j < mins[1]:
 *                                 mins[1] = i             # <<<<<<<<<<<<<<
 *                             if j > maxs[1]:
 *                                 maxs[1] = i
 */
              __pyx_t_39 = 1;
              __pyx_t_9 = -1;
              if (__pyx_t_39 < 0) {
                __pyx_t_39 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_39 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_39, __pyx_bstride_0_mins) = __pyx_v_i;
              goto __pyx_L28;
            }
            __pyx_L28:;
 92:                             if j > maxs[1]:
            /* "xutils.pyx":92
 *                             if j < mins[1]:
 *                                 mins[1] = i
 *                             if j > maxs[1]:             # <<<<<<<<<<<<<<
 *                                 maxs[1] = i
 *                             if k < mins[2]:
 */
            __pyx_t_40 = 1;
            __pyx_t_9 = -1;
            if (__pyx_t_40 < 0) {
              __pyx_t_40 += __pyx_bshape_0_maxs;
              if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_40, __pyx_bstride_0_maxs)));
            if (__pyx_t_12) {
 93:                                 maxs[1] = i
              /* "xutils.pyx":93
 *                                 mins[1] = i
 *                             if j > maxs[1]:
 *                                 maxs[1] = i             # <<<<<<<<<<<<<<
 *                             if k < mins[2]:
 *                                 mins[2] = i
 */
              __pyx_t_41 = 1;
              __pyx_t_9 = -1;
              if (__pyx_t_41 < 0) {
                __pyx_t_41 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_41 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_41, __pyx_bstride_0_maxs) = __pyx_v_i;
              goto __pyx_L29;
            }
            __pyx_L29:;
 94:                             if k < mins[2]:
            /* "xutils.pyx":94
 *                             if j > maxs[1]:
 *                                 maxs[1] = i
 *                             if k < mins[2]:             # <<<<<<<<<<<<<<
 *                                 mins[2] = i
 *                             if k > maxs[2]:
 */
            __pyx_t_42 = 2;
            __pyx_t_9 = -1;
            if (__pyx_t_42 < 0) {
              __pyx_t_42 += __pyx_bshape_0_mins;
              if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_42 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_k < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_42, __pyx_bstride_0_mins)));
            if (__pyx_t_12) {
 95:                                 mins[2] = i
              /* "xutils.pyx":95
 *                                 maxs[1] = i
 *                             if k < mins[2]:
 *                                 mins[2] = i             # <<<<<<<<<<<<<<
 *                             if k > maxs[2]:
 *                                 maxs[2] = i
 */
              __pyx_t_43 = 2;
              __pyx_t_9 = -1;
              if (__pyx_t_43 < 0) {
                __pyx_t_43 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_43 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_43 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_43, __pyx_bstride_0_mins) = __pyx_v_i;
              goto __pyx_L30;
            }
            __pyx_L30:;
 96:                             if k > maxs[2]:
            /* "xutils.pyx":96
 *                             if k < mins[2]:
 *                                 mins[2] = i
 *                             if k > maxs[2]:             # <<<<<<<<<<<<<<
 *                                 maxs[2] = i
 *     elif ndims == 4:
 */
            __pyx_t_44 = 2;
            __pyx_t_9 = -1;
            if (__pyx_t_44 < 0) {
              __pyx_t_44 += __pyx_bshape_0_maxs;
              if (unlikely(__pyx_t_44 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_44 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_12 = (__pyx_v_k > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_44, __pyx_bstride_0_maxs)));
            if (__pyx_t_12) {
 97:                                 maxs[2] = i
              /* "xutils.pyx":97
 *                                 mins[2] = i
 *                             if k > maxs[2]:
 *                                 maxs[2] = i             # <<<<<<<<<<<<<<
 *     elif ndims == 4:
 * #        with nogil:
 */
              __pyx_t_45 = 2;
              __pyx_t_9 = -1;
              if (__pyx_t_45 < 0) {
                __pyx_t_45 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_45 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_45 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_45, __pyx_bstride_0_maxs) = __pyx_v_i;
              goto __pyx_L31;
            }
            __pyx_L31:;
            goto __pyx_L25;
          }
          __pyx_L25:;
        }
      }
    }
    break;
 98:     elif ndims == 4:
  /* "xutils.pyx":98
 *                             if k > maxs[2]:
 *                                 maxs[2] = i
 *     elif ndims == 4:             # <<<<<<<<<<<<<<
 * #        with nogil:
 *             for i in range(shape[0]):
 */
  switch (__pyx_v_ndims) {

    /* "xutils.pyx":98
 *                             if k > maxs[2]:
 *                                 maxs[2] = i
 *     elif ndims == 4:             # <<<<<<<<<<<<<<
 * #        with nogil:
 *             for i in range(shape[0]):
 */
    case 4:
 99: #        with nogil:
 100:             for i in range(shape[0]):
    /* "xutils.pyx":100
 *     elif ndims == 4:
 * #        with nogil:
 *             for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):
 */
    __pyx_t_17 = 0;
    __pyx_t_9 = -1;
    if (__pyx_t_17 < 0) {
      __pyx_t_17 += __pyx_bshape_0_shape;
      if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_19 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_17, __pyx_bstride_0_shape));
    for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_19; __pyx_t_29+=1) {
      __pyx_v_i = __pyx_t_29;
 101:                 for j in range(shape[1]):
      /* "xutils.pyx":101
 * #        with nogil:
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):             # <<<<<<<<<<<<<<
 *                     for k in range(shape[2]):
 *                         for l in range(shape[3]):
 */
      __pyx_t_30 = 1;
      __pyx_t_9 = -1;
      if (__pyx_t_30 < 0) {
        __pyx_t_30 += __pyx_bshape_0_shape;
        if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 0;
      } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
      if (unlikely(__pyx_t_9 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_9);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_32 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_30, __pyx_bstride_0_shape));
      for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
        __pyx_v_j = __pyx_t_33;
 102:                     for k in range(shape[2]):
        /* "xutils.pyx":102
 *             for i in range(shape[0]):
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):             # <<<<<<<<<<<<<<
 *                         for l in range(shape[3]):
 *                             if  data[i, j, k, l] > 0.0:
 */
        __pyx_t_46 = 2;
        __pyx_t_9 = -1;
        if (__pyx_t_46 < 0) {
          __pyx_t_46 += __pyx_bshape_0_shape;
          if (unlikely(__pyx_t_46 < 0)) __pyx_t_9 = 0;
        } else if (unlikely(__pyx_t_46 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
        if (unlikely(__pyx_t_9 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_9);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_47 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_46, __pyx_bstride_0_shape));
        for (__pyx_t_48 = 0; __pyx_t_48 < __pyx_t_47; __pyx_t_48+=1) {
          __pyx_v_k = __pyx_t_48;
 103:                         for l in range(shape[3]):
          /* "xutils.pyx":103
 *                 for j in range(shape[1]):
 *                     for k in range(shape[2]):
 *                         for l in range(shape[3]):             # <<<<<<<<<<<<<<
 *                             if  data[i, j, k, l] > 0.0:
 *                                 if i < mins[0]:
 */
          __pyx_t_49 = 3;
          __pyx_t_9 = -1;
          if (__pyx_t_49 < 0) {
            __pyx_t_49 += __pyx_bshape_0_shape;
            if (unlikely(__pyx_t_49 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_49 >= __pyx_bshape_0_shape)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_50 = (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_shape.buf, __pyx_t_49, __pyx_bstride_0_shape));
          for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) {
            __pyx_v_l = __pyx_t_51;
 104:                             if  data[i, j, k, l] > 0.0:
            /* "xutils.pyx":104
 *                     for k in range(shape[2]):
 *                         for l in range(shape[3]):
 *                             if  data[i, j, k, l] > 0.0:             # <<<<<<<<<<<<<<
 *                                 if i < mins[0]:
 *                                     mins[0] = i
 */
            __pyx_t_7 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_3 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_52 = PyTuple_New(4); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_52));
            PyTuple_SET_ITEM(__pyx_t_52, 0, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_52, 1, __pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_52, 2, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_52, 3, __pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_3);
            __pyx_t_7 = 0;
            __pyx_t_1 = 0;
            __pyx_t_2 = 0;
            __pyx_t_3 = 0;
            __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_t_52)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(((PyObject *)__pyx_t_52)); __pyx_t_52 = 0;
            __pyx_t_52 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_52);
            __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_52, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_52); __pyx_t_52 = 0;
            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (__pyx_t_12) {
 105:                                 if i < mins[0]:
              /* "xutils.pyx":105
 *                         for l in range(shape[3]):
 *                             if  data[i, j, k, l] > 0.0:
 *                                 if i < mins[0]:             # <<<<<<<<<<<<<<
 *                                     mins[0] = i
 *                                 if i > maxs[0]:
 */
              __pyx_t_53 = 0;
              __pyx_t_9 = -1;
              if (__pyx_t_53 < 0) {
                __pyx_t_53 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_53 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_53 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_i < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_53, __pyx_bstride_0_mins)));
              if (__pyx_t_12) {
 106:                                     mins[0] = i
                /* "xutils.pyx":106
 *                             if  data[i, j, k, l] > 0.0:
 *                                 if i < mins[0]:
 *                                     mins[0] = i             # <<<<<<<<<<<<<<
 *                                 if i > maxs[0]:
 *                                     maxs[0] = i
 */
                __pyx_t_54 = 0;
                __pyx_t_9 = -1;
                if (__pyx_t_54 < 0) {
                  __pyx_t_54 += __pyx_bshape_0_mins;
                  if (unlikely(__pyx_t_54 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_54, __pyx_bstride_0_mins) = __pyx_v_i;
                goto __pyx_L41;
              }
              __pyx_L41:;
 107:                                 if i > maxs[0]:
              /* "xutils.pyx":107
 *                                 if i < mins[0]:
 *                                     mins[0] = i
 *                                 if i > maxs[0]:             # <<<<<<<<<<<<<<
 *                                     maxs[0] = i
 *                                 if j < mins[1]:
 */
              __pyx_t_55 = 0;
              __pyx_t_9 = -1;
              if (__pyx_t_55 < 0) {
                __pyx_t_55 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_55 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_55 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_i > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_55, __pyx_bstride_0_maxs)));
              if (__pyx_t_12) {
 108:                                     maxs[0] = i
                /* "xutils.pyx":108
 *                                     mins[0] = i
 *                                 if i > maxs[0]:
 *                                     maxs[0] = i             # <<<<<<<<<<<<<<
 *                                 if j < mins[1]:
 *                                     mins[1] = i
 */
                __pyx_t_56 = 0;
                __pyx_t_9 = -1;
                if (__pyx_t_56 < 0) {
                  __pyx_t_56 += __pyx_bshape_0_maxs;
                  if (unlikely(__pyx_t_56 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_56, __pyx_bstride_0_maxs) = __pyx_v_i;
                goto __pyx_L42;
              }
              __pyx_L42:;
 109:                                 if j < mins[1]:
              /* "xutils.pyx":109
 *                                 if i > maxs[0]:
 *                                     maxs[0] = i
 *                                 if j < mins[1]:             # <<<<<<<<<<<<<<
 *                                     mins[1] = i
 *                                 if j > maxs[1]:
 */
              __pyx_t_57 = 1;
              __pyx_t_9 = -1;
              if (__pyx_t_57 < 0) {
                __pyx_t_57 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_57 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_57 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_j < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_57, __pyx_bstride_0_mins)));
              if (__pyx_t_12) {
 110:                                     mins[1] = i
                /* "xutils.pyx":110
 *                                     maxs[0] = i
 *                                 if j < mins[1]:
 *                                     mins[1] = i             # <<<<<<<<<<<<<<
 *                                 if j > maxs[1]:
 *                                     maxs[1] = i
 */
                __pyx_t_58 = 1;
                __pyx_t_9 = -1;
                if (__pyx_t_58 < 0) {
                  __pyx_t_58 += __pyx_bshape_0_mins;
                  if (unlikely(__pyx_t_58 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_58, __pyx_bstride_0_mins) = __pyx_v_i;
                goto __pyx_L43;
              }
              __pyx_L43:;
 111:                                 if j > maxs[1]:
              /* "xutils.pyx":111
 *                                 if j < mins[1]:
 *                                     mins[1] = i
 *                                 if j > maxs[1]:             # <<<<<<<<<<<<<<
 *                                     maxs[1] = i
 *                                 if k < mins[2]:
 */
              __pyx_t_59 = 1;
              __pyx_t_9 = -1;
              if (__pyx_t_59 < 0) {
                __pyx_t_59 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_59 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_59 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_j > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_59, __pyx_bstride_0_maxs)));
              if (__pyx_t_12) {
 112:                                     maxs[1] = i
                /* "xutils.pyx":112
 *                                     mins[1] = i
 *                                 if j > maxs[1]:
 *                                     maxs[1] = i             # <<<<<<<<<<<<<<
 *                                 if k < mins[2]:
 *                                     mins[2] = i
 */
                __pyx_t_60 = 1;
                __pyx_t_9 = -1;
                if (__pyx_t_60 < 0) {
                  __pyx_t_60 += __pyx_bshape_0_maxs;
                  if (unlikely(__pyx_t_60 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_60, __pyx_bstride_0_maxs) = __pyx_v_i;
                goto __pyx_L44;
              }
              __pyx_L44:;
 113:                                 if k < mins[2]:
              /* "xutils.pyx":113
 *                                 if j > maxs[1]:
 *                                     maxs[1] = i
 *                                 if k < mins[2]:             # <<<<<<<<<<<<<<
 *                                     mins[2] = i
 *                                 if k > maxs[2]:
 */
              __pyx_t_61 = 2;
              __pyx_t_9 = -1;
              if (__pyx_t_61 < 0) {
                __pyx_t_61 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_61 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_61 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_k < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_61, __pyx_bstride_0_mins)));
              if (__pyx_t_12) {
 114:                                     mins[2] = i
                /* "xutils.pyx":114
 *                                     maxs[1] = i
 *                                 if k < mins[2]:
 *                                     mins[2] = i             # <<<<<<<<<<<<<<
 *                                 if k > maxs[2]:
 *                                     maxs[2] = i
 */
                __pyx_t_62 = 2;
                __pyx_t_9 = -1;
                if (__pyx_t_62 < 0) {
                  __pyx_t_62 += __pyx_bshape_0_mins;
                  if (unlikely(__pyx_t_62 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_62, __pyx_bstride_0_mins) = __pyx_v_i;
                goto __pyx_L45;
              }
              __pyx_L45:;
 115:                                 if k > maxs[2]:
              /* "xutils.pyx":115
 *                                 if k < mins[2]:
 *                                     mins[2] = i
 *                                 if k > maxs[2]:             # <<<<<<<<<<<<<<
 *                                     maxs[2] = i
 *                                 if l < mins[3]:
 */
              __pyx_t_63 = 2;
              __pyx_t_9 = -1;
              if (__pyx_t_63 < 0) {
                __pyx_t_63 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_63 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_63 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_k > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_63, __pyx_bstride_0_maxs)));
              if (__pyx_t_12) {
 116:                                     maxs[2] = i
                /* "xutils.pyx":116
 *                                     mins[2] = i
 *                                 if k > maxs[2]:
 *                                     maxs[2] = i             # <<<<<<<<<<<<<<
 *                                 if l < mins[3]:
 *                                     mins[3] = i
 */
                __pyx_t_64 = 2;
                __pyx_t_9 = -1;
                if (__pyx_t_64 < 0) {
                  __pyx_t_64 += __pyx_bshape_0_maxs;
                  if (unlikely(__pyx_t_64 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_64, __pyx_bstride_0_maxs) = __pyx_v_i;
                goto __pyx_L46;
              }
              __pyx_L46:;
 117:                                 if l < mins[3]:
              /* "xutils.pyx":117
 *                                 if k > maxs[2]:
 *                                     maxs[2] = i
 *                                 if l < mins[3]:             # <<<<<<<<<<<<<<
 *                                     mins[3] = i
 *                                 if l > maxs[3]:
 */
              __pyx_t_65 = 3;
              __pyx_t_9 = -1;
              if (__pyx_t_65 < 0) {
                __pyx_t_65 += __pyx_bshape_0_mins;
                if (unlikely(__pyx_t_65 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_65 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_l < (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_65, __pyx_bstride_0_mins)));
              if (__pyx_t_12) {
 118:                                     mins[3] = i
                /* "xutils.pyx":118
 *                                     maxs[2] = i
 *                                 if l < mins[3]:
 *                                     mins[3] = i             # <<<<<<<<<<<<<<
 *                                 if l > maxs[3]:
 *                                     maxs[3] = i
 */
                __pyx_t_66 = 3;
                __pyx_t_9 = -1;
                if (__pyx_t_66 < 0) {
                  __pyx_t_66 += __pyx_bshape_0_mins;
                  if (unlikely(__pyx_t_66 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_mins)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_mins.buf, __pyx_t_66, __pyx_bstride_0_mins) = __pyx_v_i;
                goto __pyx_L47;
              }
              __pyx_L47:;
 119:                                 if l > maxs[3]:
              /* "xutils.pyx":119
 *                                 if l < mins[3]:
 *                                     mins[3] = i
 *                                 if l > maxs[3]:             # <<<<<<<<<<<<<<
 *                                     maxs[3] = i
 *     else:
 */
              __pyx_t_67 = 3;
              __pyx_t_9 = -1;
              if (__pyx_t_67 < 0) {
                __pyx_t_67 += __pyx_bshape_0_maxs;
                if (unlikely(__pyx_t_67 < 0)) __pyx_t_9 = 0;
              } else if (unlikely(__pyx_t_67 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
              if (unlikely(__pyx_t_9 != -1)) {
                __Pyx_RaiseBufferIndexError(__pyx_t_9);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_12 = (__pyx_v_l > (*__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_67, __pyx_bstride_0_maxs)));
              if (__pyx_t_12) {
 120:                                     maxs[3] = i
                /* "xutils.pyx":120
 *                                     mins[3] = i
 *                                 if l > maxs[3]:
 *                                     maxs[3] = i             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("Dimensions > 4 not implemented")
 */
                __pyx_t_68 = 3;
                __pyx_t_9 = -1;
                if (__pyx_t_68 < 0) {
                  __pyx_t_68 += __pyx_bshape_0_maxs;
                  if (unlikely(__pyx_t_68 < 0)) __pyx_t_9 = 0;
                } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_maxs)) __pyx_t_9 = 0;
                if (unlikely(__pyx_t_9 != -1)) {
                  __Pyx_RaiseBufferIndexError(__pyx_t_9);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                *__Pyx_BufPtrStrided1d(long *, __pyx_bstruct_maxs.buf, __pyx_t_68, __pyx_bstride_0_maxs) = __pyx_v_i;
                goto __pyx_L48;
              }
              __pyx_L48:;
              goto __pyx_L40;
            }
            __pyx_L40:;
          }
        }
      }
    }
    break;
    default:
 121:     else:
 122:         raise RuntimeError("Dimensions > 4 not implemented")
    /* "xutils.pyx":122
 *                                     maxs[3] = i
 *     else:
 *         raise RuntimeError("Dimensions > 4 not implemented")             # <<<<<<<<<<<<<<
 *     return tuple(mins) + tuple(maxs)
 * 
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "xutils.pyx":122
 *                                     maxs[3] = i
 *     else:
 *         raise RuntimeError("Dimensions > 4 not implemented")             # <<<<<<<<<<<<<<
 *     return tuple(mins) + tuple(maxs)
 * 
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 123:     return tuple(mins) + tuple(maxs)
  /* "xutils.pyx":123
 *     else:
 *         raise RuntimeError("Dimensions > 4 not implemented")
 *     return tuple(mins) + tuple(maxs)             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_mins));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mins));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_mins));
  __pyx_t_52 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_52);
  __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxs));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_maxs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxs));
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_52, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_52); __pyx_t_52 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 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_7);
  __Pyx_XDECREF(__pyx_t_52);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxs);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shape);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mins);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("xutils.boundingBox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxs);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shape);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mins);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_shape);
  __Pyx_XDECREF((PyObject *)__pyx_v_mins);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 124: 

pyfai-0.3.5/src/splitBBox.pyx0000644001611600065110000003726311656557527015276 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#


import cython
cimport numpy
import numpy

cdef extern from "math.h":
    double floor(float)nogil


ctypedef numpy.int64_t DTYPE_int64_t
ctypedef numpy.float64_t DTYPE_float64_t
ctypedef numpy.float32_t DTYPE_float32_t


@cython.cdivision(True)
cdef float  getBinNr(float x0, float pos0_min, float dpos) nogil:
    """
    calculate the bin number for any point 
    param x0: current position
    param pos0_min: position minimum
    param dpos: bin width
    """
    return (x0 - pos0_min) / dpos


@cython.cdivision(True)
@cython.boundscheck(False)
@cython.wraparound(False)
def histoBBox1d(numpy.ndarray weights not None,
                numpy.ndarray pos0 not None,
                numpy.ndarray delta_pos0 not None,
                pos1=None,
                delta_pos1=None,
                long bins=100,
                pos0Range=None,
                pos1Range=None,
                float dummy=0.0
              ):
    """
    Calculates histogram of pos0 (tth) weighted by weights
    
    Splitting is done on the pixel's bounding box like fit2D
    
    @param weights: array with intensities
    @param pos0: 1D array with pos0: tth or q_vect
    @param delta_pos0: 1D array with delta pos0: max center-corner distance
    @param pos1: 1D array with pos1: chi
    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! 
    @param bins: number of output bins
    @param pos0Range: minimum and maximum  of the 2th range
    @param pos1Range: minimum and maximum  of the chi range
    @param dummy: value for bins without pixels 
    @return 2theta, I, weighted histogram, unweighted histogram
    """
    cdef long  size = weights.size
    assert pos0.size == size
    assert delta_pos0.size == size
    assert  bins > 1

    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = (pos0.ravel() - delta_pos0.ravel()).astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = (pos0.ravel() + delta_pos0.ravel()).astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup

    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float32")
    cdef float  deltaR, deltaL, deltaA
    cdef float pos0_min, pos0_max, pos0_maxin, pos1_min, pos1_max, pos1_maxin, min0, max0, fbin0_min, fbin0_max
    cdef int checkpos1 = 0

    if pos0Range is not None and len(pos0Range) > 1:
        pos0_min = min(pos0Range)
        if pos0_min < 0.0:
            pos0_min = 0.0
        pos0_maxin = max(pos0Range)
    else:
        pos0_min = cpos0_inf.min()
        pos0_maxin = cpos0_sup.max()
    pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)

    if pos1Range is not None and len(pos1Range) > 1:
        assert pos1.size == size
        assert delta_pos1.size == size
        checkpos1 = 1
        cpos1_inf = (pos1.ravel() - delta_pos1.ravel()).astype("float32")
        cpos1_sup = (pos1.ravel() + delta_pos1.ravel()).astype("float32")
        pos1_min = min(pos1Range)
        pos1_maxin = max(pos1Range)
        pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)

    cdef float dpos = (pos0_max - pos0_min) / (< float > (bins))
    cdef long   bin = 0
    cdef long   i, idx
    cdef long   bin0_max, bin0_min
    cdef double epsilon = 1e-10

    with nogil:
        for i in range(bins):
                outPos[i] = pos0_min + (0.5 +< float > i) * dpos

        for idx in range(size):
            data = < double > cdata[idx]
            min0 = cpos0_inf[idx]
            max0 = cpos0_sup[idx]
            if checkpos1:
                if (cpos1_inf[idx] < pos1_min) or (cpos1_sup[idx] > pos1_max):
                    continue

            fbin0_min = getBinNr(min0, pos0_min, dpos)
            fbin0_max = getBinNr(max0, pos0_min, dpos)
            bin0_min = < long > floor(fbin0_min)
            bin0_max = < long > floor(fbin0_max)

            if bin0_min == bin0_max:
                #All pixel is within a single bin
                outCount[bin0_min] += < double > 1.0
                outData[bin0_min] += < double > data

            else: #we have pixel spliting.
                deltaA = 1.0 / (fbin0_max - fbin0_min)

                deltaL = < float > (bin0_min + 1) - fbin0_min
                deltaR = fbin0_max - (< float > bin0_max)

                outCount[bin0_min] += < double > deltaA * deltaL
                outData[bin0_min] += < double > data * deltaA * deltaL

                outCount[bin0_max] += < double > deltaA * deltaR
                outData[bin0_max] += < double > data * deltaA * deltaR

                if bin0_min + 1 < bin0_max:
                    for i in range(bin0_min + 1, bin0_max):
                        outCount[i] += < double > deltaA
                        outData[i] += data * < double > deltaA

        for i in range(bins):
                if outCount[i] > epsilon:
                    outMerge[i] = < float > (outData[i] / outCount[i])
                else:
                    outMerge[i] = dummy

    return  outPos, outMerge, outData, outCount




@cython.cdivision(True)
@cython.boundscheck(False)
@cython.wraparound(False)
def histoBBox2d(numpy.ndarray weights not None,
                numpy.ndarray pos0 not None,
                numpy.ndarray delta_pos0 not None,
                numpy.ndarray pos1 not None,
                numpy.ndarray delta_pos1 not None,
                bins=(100, 36),
                pos0Range=None,
                pos1Range=None,
                float dummy=0.0):
    """
    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
    
    Splitting is done on the pixel's bounding box like fit2D
    

    @param weights: array with intensities
    @param pos0: 1D array with pos0: tth or q_vect
    @param delta_pos0: 1D array with delta pos0: max center-corner distance
    @param pos1: 1D array with pos1: chi
    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused ! 
    @param bins: number of output bins (tth=100, chi=36 by default)
    @param pos0Range: minimum and maximum  of the 2th range
    @param pos1Range: minimum and maximum  of the chi range
    @param dummy: value for bins without pixels 
    @return 2theta, I, weighted histogram, unweighted histogram
    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
    """

    cdef long  bins0, bins1, i, j, idx
    cdef long  size = weights.size
    assert pos0.size == size
    assert pos1.size == size
    assert delta_pos0.size == size
    assert delta_pos1.size == size
    try:
        bins0, bins1 = tuple(bins)
    except:
        bins0 = bins1 = < long > bins
    if bins0 <= 0:
        bins0 = 1
    if bins1 <= 0:
        bins1 = 1
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = weights.ravel().astype("float64")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0 = pos0.ravel().astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos0 = delta_pos0.ravel().astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_inf = cpos0 - cdelta_pos0
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos0_sup = cpos0 + cdelta_pos0
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1 = pos1.ravel().astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cdelta_pos1 = delta_pos1.ravel().astype("float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_inf = cpos1 - cdelta_pos1
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] cpos1_sup = cpos1 + cdelta_pos1
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype="float64")
    cdef numpy.ndarray[DTYPE_float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype="float64")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype="float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype="float32")
    cdef numpy.ndarray[DTYPE_float32_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype="float32")

    cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp
    cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
    cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max
    cdef long  bin0_max, bin0_min, bin1_max, bin1_min
    cdef double epsilon = 1e-10
    cdef double data

    if pos0Range is not None and len(pos0Range) == 2:
        pos0_min = min(pos0Range)
        pos0_maxin = max(pos0Range)
    else:
        pos0_min = max(0.0, cpos0_inf.min())
        pos0_maxin = cpos0_sup.max()
    pos0_max = pos0_maxin * (1 + numpy.finfo(numpy.float32).eps)

    if pos1Range is not None and len(pos1Range) > 1:
        pos1_min = min(pos1Range)
        pos1_maxin = max(pos1Range)
    else:
        tmp = cdelta_pos1.min()
        pos1_min = cpos1.min() - tmp
        pos1_maxin = cpos1.max() + tmp
    pos1_max = pos1_maxin * (1 + numpy.finfo(numpy.float32).eps)

    cdef float dpos0 = (pos0_max - pos0_min) / (< float > (bins0))
    cdef float dpos1 = (pos1_max - pos1_min) / (< float > (bins1))

    with nogil:
        for i in range(bins0):
                edges0[i] = pos0_min + (0.5 +< double > i) * dpos0
        for i in range(bins1):
                edges1[i] = pos1_min + (0.5 +< double > i) * dpos1

        for idx in range(size):
            data = cdata[idx]
            min0 = cpos0_inf[idx]
            max0 = cpos0_sup[idx]
            min1 = cpos1_inf[idx]
            max1 = cpos1_sup[idx]

            if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
                continue

            if min0 < pos0_min:
                min0 = pos0_min
            if min1 < pos1_min:
                min1 = pos1_min
            if max0 > pos0_maxin:
                max0 = pos0_maxin
            if max1 > pos1_maxin:
                max1 = pos1_maxin


            fbin0_min = getBinNr(min0, pos0_min, dpos0)
            fbin0_max = getBinNr(max0, pos0_min, dpos0)
            fbin1_min = getBinNr(min1, pos1_min, dpos1)
            fbin1_max = getBinNr(max1, pos1_min, dpos1)

            bin0_min = < long > floor(fbin0_min)
            bin0_max = < long > floor(fbin0_max)
            bin1_min = < long > floor(fbin1_min)
            bin1_max = < long > floor(fbin1_max)


            if bin0_min == bin0_max:
                if bin1_min == bin1_max:
                    #All pixel is within a single bin
                    outCount[bin0_min, bin1_min] += 1.0
                    outData[bin0_min, bin1_min] += data
                else:
                    #spread on more than 2 bins
                    deltaD = (< float > (bin1_min + 1)) - fbin1_min
                    deltaU = fbin1_max - (< double > bin1_max)
                    deltaA = 1.0 / (fbin1_max - fbin1_min)

                    outCount[bin0_min, bin1_min] += < double > deltaA * deltaD
                    outData[bin0_min, bin1_min] += data * deltaA * deltaD

                    outCount[bin0_min, bin1_max] += < double > deltaA * deltaU
                    outData[bin0_min, bin1_max] += data * deltaA * deltaU
                    for j in range(bin1_min + 1, bin1_max):
                        outCount[bin0_min, j] += < double > deltaA
                        outData[bin0_min, j] += data * deltaA

            else: #spread on more than 2 bins in dim 0
                if bin1_min == bin1_max:
                    #All pixel fall on 1 bins in dim 1
                    deltaA = 1.0 / (fbin0_max - fbin0_min)
                    deltaL = (< float > (bin0_min + 1)) - fbin0_min
                    outCount[bin0_min, bin1_min] += < double > deltaA * deltaL
                    outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL
                    deltaR = fbin0_max - (< float > bin0_max)
                    outCount[bin0_max, bin1_min] += < double > deltaA * deltaR
                    outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR
                    for i in range(bin0_min + 1, bin0_max):
                            outCount[i, bin1_min] += < double > deltaA
                            outData[i, bin1_min] += < double > data * deltaA
                else:
                    #spread on n pix in dim0 and m pixel in dim1:
                    deltaL = (< float > (bin0_min + 1)) - fbin0_min
                    deltaR = fbin0_max - (< float > bin0_max)
                    deltaD = (< float > (bin1_min + 1)) - fbin1_min
                    deltaU = fbin1_max - (< float > bin1_max)
                    deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))

                    outCount[bin0_min, bin1_min] += < double > deltaA * deltaL * deltaD
                    outData[bin0_min, bin1_min] += < double > data * deltaA * deltaL * deltaD

                    outCount[bin0_min, bin1_max] += < double > deltaA * deltaL * deltaU
                    outData[bin0_min, bin1_max] += < double > data * deltaA * deltaL * deltaU

                    outCount[bin0_max, bin1_min] += < double > deltaA * deltaR * deltaD
                    outData[bin0_max, bin1_min] += < double > data * deltaA * deltaR * deltaD

                    outCount[bin0_max, bin1_max] += < double > deltaA * deltaR * deltaU
                    outData[bin0_max, bin1_max] += < double > data * deltaA * deltaR * deltaU
                    for i in range(bin0_min + 1, bin0_max):
                            outCount[i, bin1_min] += < double > deltaA * deltaD
                            outData[i, bin1_min] += < double > data * deltaA * deltaD
                            for j in range(bin1_min + 1, bin1_max):
                                outCount[i, j] += < double > deltaA
                                outData[i, j] += < double > data * deltaA
                            outCount[i, bin1_max] += < double > deltaA * deltaU
                            outData[i, bin1_max] += < double > data * deltaA * deltaU
                    for j in range(bin1_min + 1, bin1_max):
                            outCount[bin0_min, j] += < double > deltaA * deltaL
                            outData[bin0_min, j] += < double > data * deltaA * deltaL

                            outCount[bin0_max, j] += < double > deltaA * deltaR
                            outData[bin0_max, j] += < double > data * deltaA * deltaR

        for i in range(bins0):
            for j in range(bins1):
                if outCount[i, j] > epsilon:
                    outMerge[i, j] = outData[i, j] / outCount[i, j]
                else:
                    outMerge[i, j] = dummy
    return outMerge.T, edges0, edges1, outData.T, outCount.T

pyfai-0.3.5/src/relabel.c0000644001611600065110000072773211706364427014376 0ustar  kieffersoft/* Generated by Cython 0.15.1+ on Fri Jan 20 23:22:14 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else

#include  /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

/* new Py3.3 unicode representation (PEP 393) */
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
  #define CYTHON_PEP393_ENABLED
  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include 
#define __PYX_HAVE__relabel
#define __PYX_HAVE_API__relabel
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include 
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include 
  #else
    #include 
  #endif
#endif

#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif

static const char *__pyx_f[] = {
  "relabel.pyx",
  "numpy.pxd",
};

/* "numpy.pxd":719
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "numpy.pxd":720
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "numpy.pxd":721
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "numpy.pxd":722
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "numpy.pxd":726
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "numpy.pxd":727
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "numpy.pxd":728
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "numpy.pxd":729
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "numpy.pxd":733
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "numpy.pxd":734
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "numpy.pxd":743
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "numpy.pxd":744
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "numpy.pxd":745
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "numpy.pxd":747
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "numpy.pxd":748
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "numpy.pxd":749
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "numpy.pxd":751
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "numpy.pxd":752
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "numpy.pxd":754
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "numpy.pxd":755
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "numpy.pxd":756
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "relabel.pyx":11
 * import numpy
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t             # <<<<<<<<<<<<<<
 * ctypedef numpy.float64_t DTYPE_float64_t
 * @cython.boundscheck(False)
 */
typedef __pyx_t_5numpy_int64_t __pyx_t_7relabel_DTYPE_int64_t;

/* "relabel.pyx":12
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t
 * ctypedef numpy.float64_t DTYPE_float64_t             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
typedef __pyx_t_5numpy_float64_t __pyx_t_7relabel_DTYPE_float64_t;

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif

/*--- Type declarations ---*/

/* "numpy.pxd":758
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "numpy.pxd":759
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "numpy.pxd":760
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "numpy.pxd":762
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;


#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

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

/* Run-time type information about structs used with buffers */
struct __Pyx_StructField_;

typedef struct {
  const char* name; /* for error messages only */
  struct __Pyx_StructField_* fields;
  size_t size;     /* sizeof(type) */
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
} __Pyx_TypeInfo;

typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;

typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;


static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif

Py_ssize_t __Pyx_zeros[] = {0};
Py_ssize_t __Pyx_minusones[] = {-1};

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif

#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_check_binary_version(void);

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

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

/* Module declarations from 'cython.cython.view' */

/* Module declarations from 'cython' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.ref' */

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

/* Module declarations from 'cpython.object' */

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

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/

/* Module declarations from 'relabel' */
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_int64_t = { "DTYPE_int64_t", NULL, sizeof(__pyx_t_7relabel_DTYPE_int64_t), 'I' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t = { "DTYPE_float64_t", NULL, sizeof(__pyx_t_7relabel_DTYPE_float64_t), 'R' };
#define __Pyx_MODULE_NAME "relabel"
int __pyx_module_is_main_relabel = 0;

/* Implementation of 'relabel' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_4[] = "ndarray is not C contiguous";
static char __pyx_k_6[] = "ndarray is not Fortran contiguous";
static char __pyx_k_8[] = "Non-native byte order not supported";
static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_14[] = "Format string allocated too short.";
static char __pyx_k_16[] = "Jerome Kieffer";
static char __pyx_k_17[] = "Jerome.kieffer@esrf.fr";
static char __pyx_k_18[] = "GPLv3+";
static char __pyx_k_21[] = "/home/jerome/workspace/azimuthal/pyFAI/src/relabel.pyx";
static char __pyx_k__B[] = "B";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__L[] = "L";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__b[] = "b";
static char __pyx_k__d[] = "d";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__l[] = "l";
static char __pyx_k__q[] = "q";
static char __pyx_k__s[] = "s";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__idx[] = "idx";
static char __pyx_k__max[] = "max";
static char __pyx_k__data[] = "data";
static char __pyx_k__size[] = "size";
static char __pyx_k__cdata[] = "cdata";
static char __pyx_k__count[] = "count";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__int64[] = "int64";
static char __pyx_k__label[] = "label";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__range[] = "range";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k__astype[] = "astype";
static char __pyx_k__blured[] = "blured";
static char __pyx_k__clabel[] = "clabel";
static char __pyx_k__stable[] = "stable";
static char __pyx_k__cblured[] = "cblured";
static char __pyx_k__flatten[] = "flatten";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__maxData[] = "maxData";
static char __pyx_k__relabel[] = "relabel";
static char __pyx_k__20110923[] = "20110923";
static char __pyx_k____date__[] = "__date__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__maxDelta[] = "maxDelta";
static char __pyx_k__maxLabel[] = "maxLabel";
static char __pyx_k__countThem[] = "countThem";
static char __pyx_k__maxBlured[] = "maxBlured";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k____author__[] = "__author__";
static char __pyx_k____status__[] = "__status__";
static char __pyx_k____contact__[] = "__contact__";
static char __pyx_k____license__[] = "__license__";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static PyObject *__pyx_kp_u_10;
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_u_4;
static PyObject *__pyx_kp_u_6;
static PyObject *__pyx_kp_u_8;
static PyObject *__pyx_kp_s__20110923;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____author__;
static PyObject *__pyx_n_s____contact__;
static PyObject *__pyx_n_s____date__;
static PyObject *__pyx_n_s____license__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____status__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__astype;
static PyObject *__pyx_n_s__b;
static PyObject *__pyx_n_s__blured;
static PyObject *__pyx_n_s__cblured;
static PyObject *__pyx_n_s__cdata;
static PyObject *__pyx_n_s__clabel;
static PyObject *__pyx_n_s__count;
static PyObject *__pyx_n_s__countThem;
static PyObject *__pyx_n_s__d;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__flatten;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__idx;
static PyObject *__pyx_n_s__int64;
static PyObject *__pyx_n_s__label;
static PyObject *__pyx_n_s__max;
static PyObject *__pyx_n_s__maxBlured;
static PyObject *__pyx_n_s__maxData;
static PyObject *__pyx_n_s__maxDelta;
static PyObject *__pyx_n_s__maxLabel;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__relabel;
static PyObject *__pyx_n_s__s;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__stable;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_int_15;
static PyObject *__pyx_k_tuple_1;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_3;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_13;
static PyObject *__pyx_k_tuple_15;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_codeobj_20;

/* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */

static PyObject *__pyx_pf_7relabel_countThem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7relabel_countThem[] = "\n    @param label: 2D array containing labeled zones\n    @param data: 2D array containing the raw data\n    @param blured: 2D array containing the blured data\n    @return: 2D arrays containing: \n        * count pixels in labelled zone: label == index).sum() \n        * max of data in that zone:      data[label == index].max()\n        * max of blured in that zone:    blured[label == index].max()\n        * data-blured where data is max.   \n    ";
static PyMethodDef __pyx_mdef_7relabel_countThem = {__Pyx_NAMESTR("countThem"), (PyCFunction)__pyx_pf_7relabel_countThem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7relabel_countThem)};
static PyObject *__pyx_pf_7relabel_countThem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_label = 0;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_blured = 0;
  int __pyx_v_maxLabel;
  PyArrayObject *__pyx_v_clabel = 0;
  PyArrayObject *__pyx_v_cdata = 0;
  PyArrayObject *__pyx_v_cblured = 0;
  PyArrayObject *__pyx_v_count = 0;
  PyArrayObject *__pyx_v_maxData = 0;
  PyArrayObject *__pyx_v_maxBlured = 0;
  PyArrayObject *__pyx_v_maxDelta = 0;
  long __pyx_v_s;
  long __pyx_v_i;
  long __pyx_v_idx;
  double __pyx_v_d;
  double __pyx_v_b;
  Py_buffer __pyx_bstruct_count;
  Py_ssize_t __pyx_bstride_0_count = 0;
  Py_ssize_t __pyx_bshape_0_count = 0;
  Py_buffer __pyx_bstruct_maxData;
  Py_ssize_t __pyx_bstride_0_maxData = 0;
  Py_ssize_t __pyx_bshape_0_maxData = 0;
  Py_buffer __pyx_bstruct_maxDelta;
  Py_ssize_t __pyx_bstride_0_maxDelta = 0;
  Py_ssize_t __pyx_bshape_0_maxDelta = 0;
  Py_buffer __pyx_bstruct_maxBlured;
  Py_ssize_t __pyx_bstride_0_maxBlured = 0;
  Py_ssize_t __pyx_bshape_0_maxBlured = 0;
  Py_buffer __pyx_bstruct_cdata;
  Py_ssize_t __pyx_bstride_0_cdata = 0;
  Py_ssize_t __pyx_bshape_0_cdata = 0;
  Py_buffer __pyx_bstruct_cblured;
  Py_ssize_t __pyx_bstride_0_cblured = 0;
  Py_ssize_t __pyx_bshape_0_cblured = 0;
  Py_buffer __pyx_bstruct_clabel;
  Py_ssize_t __pyx_bstride_0_clabel = 0;
  Py_ssize_t __pyx_bshape_0_clabel = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyArrayObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyArrayObject *__pyx_t_12 = NULL;
  PyArrayObject *__pyx_t_13 = NULL;
  long __pyx_t_14;
  int __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  long __pyx_t_20;
  long __pyx_t_21;
  long __pyx_t_22;
  long __pyx_t_23;
  long __pyx_t_24;
  long __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__label,&__pyx_n_s__data,&__pyx_n_s__blured,0};
  __Pyx_RefNannySetupContext("countThem");
  __pyx_self = __pyx_self;
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blured);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "countThem") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_label = ((PyArrayObject *)values[0]);
    __pyx_v_data = ((PyArrayObject *)values[1]);
    __pyx_v_blured = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countThem", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("relabel.countThem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_clabel.buf = NULL;
  __pyx_bstruct_cdata.buf = NULL;
  __pyx_bstruct_cblured.buf = NULL;
  __pyx_bstruct_count.buf = NULL;
  __pyx_bstruct_maxData.buf = NULL;
  __pyx_bstruct_maxBlured.buf = NULL;
  __pyx_bstruct_maxDelta.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 0, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_blured), __pyx_ptype_5numpy_ndarray, 0, "blured", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":28
 *         * data-blured where data is max.
 *     """
 *     cdef int maxLabel = label.max()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__max); 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);
  __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 = 28; __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_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_maxLabel = __pyx_t_3;

  /* "relabel.pyx":29
 *     """
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_clabel, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_clabel = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_clabel.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_clabel = __pyx_bstruct_clabel.strides[0];
      __pyx_bshape_0_clabel = __pyx_bstruct_clabel.shape[0];
    }
  }
  __pyx_t_4 = 0;
  __pyx_v_clabel = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "relabel.pyx":30
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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__flatten); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cdata, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cdata.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cdata = __pyx_bstruct_cdata.strides[0];
      __pyx_bshape_0_cdata = __pyx_bstruct_cdata.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "relabel.pyx":31
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_blured), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flatten); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cblured, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cblured = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cblured.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_cblured = __pyx_bstruct_cblured.strides[0];
      __pyx_bshape_0_cblured = __pyx_bstruct_cblured.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_cblured = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "relabel.pyx":32
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong((__pyx_v_maxLabel + 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);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__int64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_count, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_count = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_count.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_count = __pyx_bstruct_count.strides[0];
      __pyx_bshape_0_count = __pyx_bstruct_count.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_count = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "relabel.pyx":33
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); 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);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromLong((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxData, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxData.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxData = __pyx_bstruct_maxData.strides[0];
      __pyx_bshape_0_maxData = __pyx_bstruct_maxData.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_maxData = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "relabel.pyx":34
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef long s , i, idx
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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__float64); 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;
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); 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_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxBlured, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxBlured = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxBlured.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxBlured = __pyx_bstruct_maxBlured.strides[0];
      __pyx_bshape_0_maxBlured = __pyx_bstruct_maxBlured.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_maxBlured = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "relabel.pyx":35
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float64)             # <<<<<<<<<<<<<<
 *     cdef long s , i, idx
 *     cdef double d, b
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong((__pyx_v_maxLabel + 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); 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_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __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_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_8, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_maxDelta, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_7relabel_DTYPE_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_maxDelta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_maxDelta.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_maxDelta = __pyx_bstruct_maxDelta.strides[0];
      __pyx_bshape_0_maxDelta = __pyx_bstruct_maxDelta.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_maxDelta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "relabel.pyx":38
 *     cdef long s , i, idx
 *     cdef double d, b
 *     s = < long > label.size             # <<<<<<<<<<<<<<
 *     assert s == cdata.size
 *     assert s == cblured.size
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = ((long)__pyx_t_14);

  /* "relabel.pyx":39
 *     cdef double d, b
 *     s = < long > label.size
 *     assert s == cdata.size             # <<<<<<<<<<<<<<
 *     assert s == cblured.size
 *     for i in range(s):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_cdata), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_15)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "relabel.pyx":40
 *     s = < long > label.size
 *     assert s == cdata.size
 *     assert s == cblured.size             # <<<<<<<<<<<<<<
 *     for i in range(s):
 *         idx = < long > clabel[i]
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_7 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_cblured), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_15)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "relabel.pyx":41
 *     assert s == cdata.size
 *     assert s == cblured.size
 *     for i in range(s):             # <<<<<<<<<<<<<<
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]
 */
  __pyx_t_14 = __pyx_v_s;
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) {
    __pyx_v_i = __pyx_t_16;

    /* "relabel.pyx":42
 *     assert s == cblured.size
 *     for i in range(s):
 *         idx = < long > clabel[i]             # <<<<<<<<<<<<<<
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]
 */
    __pyx_t_17 = __pyx_v_i;
    __pyx_v_idx = ((long)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_int64_t *, __pyx_bstruct_clabel.buf, __pyx_t_17, __pyx_bstride_0_clabel)));

    /* "relabel.pyx":43
 *     for i in range(s):
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]             # <<<<<<<<<<<<<<
 *         b = < double > cblured[i]
 *         count[idx] += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_v_d = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_cdata.buf, __pyx_t_18, __pyx_bstride_0_cdata)));

    /* "relabel.pyx":44
 *         idx = < long > clabel[i]
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]             # <<<<<<<<<<<<<<
 *         count[idx] += 1
 *         if d > maxData[idx]:
 */
    __pyx_t_19 = __pyx_v_i;
    __pyx_v_b = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_cblured.buf, __pyx_t_19, __pyx_bstride_0_cblured)));

    /* "relabel.pyx":45
 *         d = < double > cdata[i]
 *         b = < double > cblured[i]
 *         count[idx] += 1             # <<<<<<<<<<<<<<
 *         if d > maxData[idx]:
 *             maxData[idx] = d
 */
    __pyx_t_20 = __pyx_v_idx;
    *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_int64_t *, __pyx_bstruct_count.buf, __pyx_t_20, __pyx_bstride_0_count) += 1;

    /* "relabel.pyx":46
 *         b = < double > cblured[i]
 *         count[idx] += 1
 *         if d > maxData[idx]:             # <<<<<<<<<<<<<<
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b
 */
    __pyx_t_21 = __pyx_v_idx;
    __pyx_t_15 = (__pyx_v_d > (*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxData.buf, __pyx_t_21, __pyx_bstride_0_maxData)));
    if (__pyx_t_15) {

      /* "relabel.pyx":47
 *         count[idx] += 1
 *         if d > maxData[idx]:
 *             maxData[idx] = d             # <<<<<<<<<<<<<<
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:
 */
      __pyx_t_22 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxData.buf, __pyx_t_22, __pyx_bstride_0_maxData) = __pyx_v_d;

      /* "relabel.pyx":48
 *         if d > maxData[idx]:
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b             # <<<<<<<<<<<<<<
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b
 */
      __pyx_t_23 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxDelta.buf, __pyx_t_23, __pyx_bstride_0_maxDelta) = (__pyx_v_d - __pyx_v_b);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "relabel.pyx":49
 *             maxData[idx] = d
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:             # <<<<<<<<<<<<<<
 *             maxBlured[idx] = b
 *     return count, maxData, maxBlured, maxDelta
 */
    __pyx_t_24 = __pyx_v_idx;
    __pyx_t_15 = (__pyx_v_b > (*__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxBlured.buf, __pyx_t_24, __pyx_bstride_0_maxBlured)));
    if (__pyx_t_15) {

      /* "relabel.pyx":50
 *             maxDelta[idx] = d - b
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b             # <<<<<<<<<<<<<<
 *     return count, maxData, maxBlured, maxDelta
 * 
 */
      __pyx_t_25 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_7relabel_DTYPE_float64_t *, __pyx_bstruct_maxBlured.buf, __pyx_t_25, __pyx_bstride_0_maxBlured) = __pyx_v_b;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }

  /* "relabel.pyx":51
 *         if b > maxBlured[idx]:
 *             maxBlured[idx] = b
 *     return count, maxData, maxBlured, maxDelta             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_count));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_count));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxData));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_maxData));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxData));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxBlured));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_maxBlured));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxBlured));
  __Pyx_INCREF(((PyObject *)__pyx_v_maxDelta));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_maxDelta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maxDelta));
  __pyx_r = ((PyObject *)__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_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxData);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxDelta);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxBlured);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cblured);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_clabel);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("relabel.countThem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxData);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxDelta);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_maxBlured);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cdata);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cblured);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_clabel);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_clabel);
  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
  __Pyx_XDECREF((PyObject *)__pyx_v_cblured);
  __Pyx_XDECREF((PyObject *)__pyx_v_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxData);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxBlured);
  __Pyx_XDECREF((PyObject *)__pyx_v_maxDelta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":190
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":196
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":199
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":200
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":202
 *             cdef bint little_endian = ((&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":204
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":205
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "numpy.pxd":207
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L6:;

  /* "numpy.pxd":209
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  if (__pyx_t_1) {

    /* "numpy.pxd":210
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":211
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "numpy.pxd":213
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  if (__pyx_t_3) {

    /* "numpy.pxd":214
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "numpy.pxd":217
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":218
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "numpy.pxd":219
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":222
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "numpy.pxd":223
 *                 # This is allocated as one block, strides first.
 *                 info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "numpy.pxd":224
 *                 info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":225
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);

      /* "numpy.pxd":226
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L9;
  }
  /*else*/ {

    /* "numpy.pxd":228
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));

    /* "numpy.pxd":229
 *             else:
 *                 info.strides = PyArray_STRIDES(self)
 *                 info.shape = PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
  }
  __pyx_L9:;

  /* "numpy.pxd":230
 *                 info.strides = PyArray_STRIDES(self)
 *                 info.shape = PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "numpy.pxd":231
 *                 info.shape = PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":232
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));

  /* "numpy.pxd":235
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":236
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;

  /* "numpy.pxd":240
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":242
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = (!__pyx_v_hasfields);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":244
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "numpy.pxd":247
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L12:;

  /* "numpy.pxd":249
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":250
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "numpy.pxd":251
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":252
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "numpy.pxd":254
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L15;
    }

    /* "numpy.pxd":255
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L15;
    }

    /* "numpy.pxd":256
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L15;
    }

    /* "numpy.pxd":257
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L15;
    }

    /* "numpy.pxd":258
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L15;
    }

    /* "numpy.pxd":259
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L15;
    }

    /* "numpy.pxd":260
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L15;
    }

    /* "numpy.pxd":261
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L15;
    }

    /* "numpy.pxd":262
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":263
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":264
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L15;
    }

    /* "numpy.pxd":265
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L15;
    }

    /* "numpy.pxd":266
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L15;
    }

    /* "numpy.pxd":267
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L15;
    }

    /* "numpy.pxd":268
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L15;
    }

    /* "numpy.pxd":269
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L15;
    }

    /* "numpy.pxd":270
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "numpy.pxd":272
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L15:;

    /* "numpy.pxd":273
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":274
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "numpy.pxd":276
 *                 return
 *             else:
 *                 info.format = stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":277
 *             else:
 *                 info.format = stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":278
 *                 info.format = stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "numpy.pxd":281
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":282
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L13:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":284
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");

  /* "numpy.pxd":285
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "numpy.pxd":286
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":287
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":288
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":764
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1");

  /* "numpy.pxd":765
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":767
 *     return PyArray_MultiIterNew(1, a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, a, b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");

  /* "numpy.pxd":768
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, a, b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":770
 *     return PyArray_MultiIterNew(2, a, b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, a, b,  c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");

  /* "numpy.pxd":771
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, a, b,  c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":773
 *     return PyArray_MultiIterNew(3, a, b,  c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, a, b, c,  d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");

  /* "numpy.pxd":774
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, a, b, c,  d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":776
 *     return PyArray_MultiIterNew(4, a, b, c,  d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");

  /* "numpy.pxd":777
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":779
 *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring");

  /* "numpy.pxd":786
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":787
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":790
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":791
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "numpy.pxd":792
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "numpy.pxd":794
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __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[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "numpy.pxd":795
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "numpy.pxd":797
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_6 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_6) {
      __pyx_t_7 = __pyx_v_little_endian;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "numpy.pxd":798
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_6 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_6) {
        __pyx_t_8 = (!__pyx_v_little_endian);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "numpy.pxd":809
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "numpy.pxd":810
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":811
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":812
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_10 = 0;
      (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
    }

    /* "numpy.pxd":814
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_10 = 0;
    (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);

    /* "numpy.pxd":816
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_6) {

      /* "numpy.pxd":817
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":818
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_6) {

        /* "numpy.pxd":819
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "numpy.pxd":822
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "numpy.pxd":823
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "numpy.pxd":824
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "numpy.pxd":825
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "numpy.pxd":826
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "numpy.pxd":827
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "numpy.pxd":828
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "numpy.pxd":829
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "numpy.pxd":830
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "numpy.pxd":831
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "numpy.pxd":832
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "numpy.pxd":833
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "numpy.pxd":834
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "numpy.pxd":835
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":836
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":837
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":838
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "numpy.pxd":840
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "numpy.pxd":841
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "numpy.pxd":845
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_11;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":846
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":961
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base");

  /* "numpy.pxd":963
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  if (__pyx_t_1) {

    /* "numpy.pxd":964
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":966
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "numpy.pxd":967
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "numpy.pxd":968
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "numpy.pxd":969
 *          baseptr = base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":971
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base");

  /* "numpy.pxd":972
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":973
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":975
 *         return None
 *     else:
 *         return arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("relabel"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
  {&__pyx_kp_s__20110923, __pyx_k__20110923, sizeof(__pyx_k__20110923), 0, 0, 1, 0},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1},
  {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
  {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1},
  {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____status__, __pyx_k____status__, sizeof(__pyx_k____status__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1},
  {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
  {&__pyx_n_s__blured, __pyx_k__blured, sizeof(__pyx_k__blured), 0, 0, 1, 1},
  {&__pyx_n_s__cblured, __pyx_k__cblured, sizeof(__pyx_k__cblured), 0, 0, 1, 1},
  {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1},
  {&__pyx_n_s__clabel, __pyx_k__clabel, sizeof(__pyx_k__clabel), 0, 0, 1, 1},
  {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1},
  {&__pyx_n_s__countThem, __pyx_k__countThem, sizeof(__pyx_k__countThem), 0, 0, 1, 1},
  {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__flatten, __pyx_k__flatten, sizeof(__pyx_k__flatten), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
  {&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1},
  {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
  {&__pyx_n_s__maxBlured, __pyx_k__maxBlured, sizeof(__pyx_k__maxBlured), 0, 0, 1, 1},
  {&__pyx_n_s__maxData, __pyx_k__maxData, sizeof(__pyx_k__maxData), 0, 0, 1, 1},
  {&__pyx_n_s__maxDelta, __pyx_k__maxDelta, sizeof(__pyx_k__maxDelta), 0, 0, 1, 1},
  {&__pyx_n_s__maxLabel, __pyx_k__maxLabel, sizeof(__pyx_k__maxLabel), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__relabel, __pyx_k__relabel, sizeof(__pyx_k__relabel), 0, 0, 1, 1},
  {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__stable, __pyx_k__stable, sizeof(__pyx_k__stable), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "relabel.pyx":29
 *     """
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__int64));
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__int64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));

  /* "relabel.pyx":30
 *     cdef int maxLabel = label.max()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "relabel.pyx":31
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] clabel = label.astype("int64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cdata = data.astype("float64").flatten()
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] cblured = blured.astype("float64").flatten()             # <<<<<<<<<<<<<<
 *     cdef numpy.ndarray[DTYPE_int64_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.int64)
 *     cdef numpy.ndarray[DTYPE_float64_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float64)
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__float64));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

  /* "numpy.pxd":211
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));

  /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "numpy.pxd":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "numpy.pxd":795
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));

  /* "numpy.pxd":819
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_14));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));

  /* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */
  __pyx_k_tuple_19 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__label));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__label));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__blured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__blured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxLabel));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__maxLabel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxLabel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__clabel));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__clabel));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clabel));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__cdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cblured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__cblured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cblured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxData));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__maxData));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxData));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxBlured));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__maxBlured));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxBlured));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxDelta));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__maxDelta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxDelta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__s));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__d));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
  __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__countThem, 15, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initrelabel(void); /*proto*/
PyMODINIT_FUNC initrelabel(void)
#else
PyMODINIT_FUNC PyInit_relabel(void); /*proto*/
PyMODINIT_FUNC PyInit_relabel(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_relabel(void)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("relabel"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_relabel) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "relabel.pyx":2
 * 
 * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":3
 * 
 * __author__ = "Jerome Kieffer"
 * __contact__ = "Jerome.kieffer@esrf.fr"             # <<<<<<<<<<<<<<
 * __date__ = "20110923"
 * __status__ = "stable"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":4
 * __author__ = "Jerome Kieffer"
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"             # <<<<<<<<<<<<<<
 * __status__ = "stable"
 * __license__ = "GPLv3+"
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s__20110923)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":5
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 * __status__ = "stable"             # <<<<<<<<<<<<<<
 * __license__ = "GPLv3+"
 * import cython
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____status__, ((PyObject *)__pyx_n_s__stable)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":6
 * __date__ = "20110923"
 * __status__ = "stable"
 * __license__ = "GPLv3+"             # <<<<<<<<<<<<<<
 * import cython
 * cimport numpy
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_18)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "relabel.pyx":9
 * import cython
 * cimport numpy
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * ctypedef numpy.int64_t DTYPE_int64_t
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __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 = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "relabel.pyx":15
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def countThem(numpy.ndarray label not None, \             # <<<<<<<<<<<<<<
 *               numpy.ndarray data not None, \
 *               numpy.ndarray blured not None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7relabel_countThem, NULL, __pyx_n_s__relabel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__countThem, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "relabel.pyx":2
 * 
 * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
 * __contact__ = "Jerome.kieffer@esrf.fr"
 * __date__ = "20110923"
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "numpy.pxd":971
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (__pyx_m) {
    __Pyx_AddTraceback("init relabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init relabel");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}

typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
} __Pyx_BufFmt_Context;

static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}

static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}

static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}

static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'b': return "'char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 0: return "end";
    default: return "unparseable format string";
  }
}

static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif

static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
    case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
    case 'O': return 'O';
    case 'P': return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}

static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset;
  if (ctx->enc_type == 0) return 0;
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;

    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
    }

    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        /* special case -- treat as struct rather than complex number */
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }

      __Pyx_BufFmt_RaiseExpected(ctx);
      return -1;
    }

    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }

    ctx->fmt_offset += size;

    --ctx->enc_count; /* Consume from buffer string */

    /* Done checking, move to next field, pushing or popping struct stack if needed */
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}

static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        ++ts;
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          /* Continue pooling same type */
          ctx->enc_count += ctx->new_count;
        } else {
          /* New type */
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ParseNumber(&ts);
          if (number == -1) { /* First char was not a digit */
            PyErr_Format(PyExc_ValueError,
                         "Does not understand character buffer dtype format string ('%c')", *ts);
            return NULL;
          }
          ctx->new_count = (size_t)number; 
        }
    }
  }
}

static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}

static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}

static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise ,  */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  #endif
  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
  else {
  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  return -1;
    }
}

static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  PyObject* obj = view->obj;
  if (obj) {
    #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;}
    #endif
    if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];

    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
pyfai-0.3.5/stdeb.cfg0000644001611600065110000000035611633464435013600 0ustar  kieffersoft[DEFAULT]
Package: python-pyfai
Depends: python-imaging, python-numpy, python-scipy, python-matplotlib
XS-Python-Version: >= 2.6 
Maintainer: Jerome Kieffer 
Build-Depends: python-dev
Recommends: python-numpy-ext

pyfai-0.3.5/scripts/0000755001611600065110000000000011706351345013475 5ustar  kieffersoftpyfai-0.3.5/scripts/pyFAI-waxs0000755001611600065110000000716511706360127015362 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Fast Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "21/12/2011"
__status__ = "production"
__doc__ = """ 
pyFAI-waxs is the Waxs script of pyFAI that allows data reduction for Wide Angle Scattering, 
producing output in 2-theta range output in radial dimension (and in degrees).

Parameters:
 -p=param.poni         PyFAI parameter file 
 -m=mask.edf           mask image
 -d=-2                 dummy value for dead pixels
 -dd=-1.1              delta dummy 

 -h                    print help and exit
 
    Usage:
python pyFAI-waxs -p=param.poni  file.edf file2.edf file3.edf
"""
import os, sys, time, fabio

import pyFAI
from pyFAI import AzimuthalIntegrator

if __name__ == "__main__":
    paramFile = None
    processFile = []
    dummy = None
    delta_dummy = None
    mask = None
    for param in sys.argv[1:]:
        if param.startswith("-p="):
            paramFile = param.split("=", 1)[1]
        elif param.startswith("-d="):
            dummy = float(param.split("=", 1)[1])
        elif param.startswith("-dd="):
            delta_dummy = float(param.split("=", 1)[1])
        elif param.startswith("-m="):
            mask = param.split("=", 1)[1]
        elif param.startswith("--version"):
            print(pyFAI.version + os.linesep)
            sys.exit(0)
        elif param.find("-h") in [0, 1]:
            print(__doc__)
            sys.exit(0)
        elif os.path.isfile(param):
            processFile.append(param)
    if paramFile and processFile:
        integrator = AzimuthalIntegrator()
        integrator.setChiDiscAtZero()
        integrator.load(paramFile)
        if mask is not None:
            mask = fabio.open(mask).data
        print integrator
        for oneFile in processFile:
            sys.stdout.write("Integrating %s --> " % oneFile)
            outFile = os.path.splitext(oneFile)[0] + ".xy"
            azimFile = os.path.splitext(oneFile)[0] + ".azim"
            data = fabio.open(oneFile).data.astype("float32")
            t0 = time.time()
            tth, I = integrator.xrpd(data=data, nbPt=min(data.shape), filename=outFile, correctSolidAngle=True,
                                     mask=mask, dummy=dummy, delta_dummy=delta_dummy)
            t1 = time.time()
            integrator.xrpd2(data, 1000, 360, azimFile,
                             mask=mask, dummy=dummy, delta_dummy=delta_dummy)
            print "%s\t 1D took  %.3fs, 2D took %.3fs" % (outFile, t1 - t0, time.time() - t1)
            print "raw int: %s ; integrated: %s " % (data.sum() / data.size, I.sum() / I.size)
    else:
        print(__doc__)

pyfai-0.3.5/scripts/pyFAI-calib0000755001611600065110000002364211706357706015461 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

"""
pyFAI-calib

A tool for determining the geometry of a detector using a reference sample.

usage:
  python2.6 pyFAI-calib [-g=100] [-nd] [-d] [-pix=172e-6,172e-6] inputFile.edf
  
-g= size of the gap (in pixels) between two consecutive rings, by default size/20 
Increase the value if the arc is not complete
Decrease the value if arcs are mixed together.  

-nd : to avoid diagonal expansion of the various massifs. (default)  
-d  : to allow diagonal expansion of the various massifs.
-spline=/path/to/file.spline
-min for automatic removal of background (or -min=100 if you know the value)
 
"""

__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "21/12/2011"
__satus__ = "development"

import os, sys, gc, threading, time, logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("pyFAI.calib")
import numpy
from numpy import sin, cos, arccos, sqrt, floor, ceil, radians, degrees, pi
import fabio
import matplotlib
import pylab
from scipy.optimize import fmin, leastsq, fmin_slsqp, anneal
from scipy.interpolate import interp2d
import pyFAI
from pyFAI.geometryRefinement import GeometryRefinement
from pyFAI.peakPicker import PeakPicker
from pyFAI.utils import averageImages
from  matplotlib.path import Path
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt


try:
    from rfoo.utils import rconsole
    rconsole.spawn_server()
except ImportError:
    logging.info("No socket opened for debugging -> install rfoo")


def main():
    pixelSize = None
    gaussianWidth = None
    listInputFiles = []
    labelPattern = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]
    splineFile = None
    cutBackground = None
    for  arg in sys.argv[1:]:
        if arg == "-test":
            test()
            sys.exit(0)
        elif arg.find("-debug") in [0, 1]:
            logger.setLevel(logging.DEBUG)
        elif arg.find("-g=") in [0, 1]:
            gaussianWidth = float(arg.split("=")[1])
        elif arg.find("-d") in [0, 1]:
            labelPattern = [[1] * 3] * 3
        elif arg.find("-nd") in [0, 1]:
            labelPattern = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]
        elif arg.find("-min") in [0, 1]:
            cutBackground = True
            if "=" in arg:
                cutBackground = float(arg.split("=")[1])
        elif arg.find("-spline=") in [0, 1]:
            splineFile = arg.split("=")[1]
            if not os.path.isfile(splineFile):
                splineFile = None
        elif arg.find("-pix=") in [0, 1]:
            pixels = arg.split("=")[1]
            if "," in pixels:
                pixelSize = [float(i) for  i in pixels.split(",")[:2]]
            else:
                pixelSize = [float(pixels), float(pixels)]
        elif arg.startswith("--version"):
            print(pyFAI.version)
            sys.exit(0)
        elif arg.find("-h") in [0, 1]:
            print(__doc__)
            sys.exit(0)
        elif  os.path.isfile(arg):
            listInputFiles.append(arg)

    if len(listInputFiles) == 0:
        logging.info(__doc__)
        sys.exit(1)

    elif len(listInputFiles) == 1:
        if cutBackground:
            inputFile = averageImages(listInputFiles, "merged.edf", minimum=cutBackground)
        else:
            inputFile = listInputFiles[0]
    else:
        inputFile = averageImages(listInputFiles, "merged.edf", minimum=cutBackground)

    peakPicker = PeakPicker(inputFile)
    if gaussianWidth is not None:
        peakPicker.massif.setValleySize(gaussianWidth)
    else:
        peakPicker.massif.initValleySize()
    oneThread = threading.Thread(target=peakPicker.massif.getLabeledMassif, args=(labelPattern,))
    oneThread.start()
    if  (pixelSize is None) and (splineFile is None):
        pixelSize = [1.5e-5, 1.5e-5]
        ans = raw_input("Please enter the pixel size (in meter, C order, i.e. %.2e %.2e) or a spline file: " % tuple(pixelSize)).strip()
        if os.path.isfile(ans):
            splineFile = ans
        elif len(ans.split()) == 2:
            px = ans.split()
            try:
                pixelSize = [float(i) for i in px[0:2]]
            except:
                logging.error("error in reading pixel size")
                sys.exit(1)
        elif len(ans.split()) == 1:
            px = ans
            try:
                pixelSize = [float(px), float(px)]
            except:
                logging.error("error in reading pixel size")
                sys.exit(1)
    basename = os.path.splitext(inputFile)[0]
    peakPicker.gui(True)
    datafile = os.path.splitext(inputFile)[0] + ".npt"
    if os.path.isfile(datafile):
        peakPicker.load(datafile)
    data = peakPicker.finish(datafile)
    if os.name == "nt":
        logging.info("We are under windows, matplotlib is not able to display too many images without crashing, this is why the window showing the diffraction image is closed")
        peakPicker.closeGUI()
    if splineFile:
        geoRef = GeometryRefinement(data, dist=0.1, splineFile=splineFile)
    else:
        geoRef = GeometryRefinement(data, dist=0.1, pixel1=pixelSize[0], pixel2=pixelSize[1])
    paramfile = os.path.splitext(inputFile)[0] + ".poni"
    if os.path.isfile(paramfile):
        geoRef.load(paramfile)
    print geoRef
    previous = sys.maxint
#    geoRef.spline.writeEDF("fromSpline")
    finished = False
    fig2 = None
    while not finished:
        while previous > geoRef.chi2():
            previous = geoRef.chi2()
            geoRef.refine2(1000000)
            print geoRef
#        geoRef.refine1()
        print geoRef
        geoRef.save(basename + ".poni")
        geoRef.del_ttha()
        geoRef.del_dssa()
        geoRef.del_chia()
        t0 = time.time()
        tth = geoRef.twoThetaArray(peakPicker.shape)
        t1 = time.time()
        dsa = geoRef.solidAngleArray(peakPicker.shape)
        t2 = time.time()
        geoRef.chiArray(peakPicker.shape)
        t2a = time.time()
        geoRef.cornerArray(peakPicker.shape)
        t2b = time.time()
        if os.name == "nt":
            logging.info("We are under windows, matplotlib is not able to display too many images without crashing, this is why little information is displayed")
        else:
            peakPicker.contour(tth)
            if fig2 is None:
                fig2 = pylab.plt.figure()
                sp = fig2.add_subplot(111)
            else:
                sp.images.pop()
            sp.imshow(dsa)
            #self.fig.canvas.draw()
            fig2.show()

        change = raw_input("Modify parameters ?\t ").strip()
        if (change == '') or (change.lower()[0] == "n"):
            finished = True
        else:
            peakPicker.readFloatFromKeyboard("Enter Distance in meter (or dist_min[%.3f] dist[%.3f] dist_max[%.3f]):\t " % (geoRef.dist_min, geoRef.dist, geoRef.dist_max), {1:[geoRef.set_dist], 3:[ geoRef.set_dist_min, geoRef.set_dist, geoRef.set_dist_max]})
            peakPicker.readFloatFromKeyboard("Enter Poni1 in meter (or poni1_min[%.3f] poni1[%.3f] poni1_max[%.3f]):\t " % (geoRef.poni1_min, geoRef.poni1, geoRef.poni1_max), {1:[geoRef.set_poni1], 3:[ geoRef.set_poni1_min, geoRef.set_poni1, geoRef.set_poni1_max]})
            peakPicker.readFloatFromKeyboard("Enter Poni2 in meter (or poni2_min[%.3f] poni2[%.3f] poni2_max[%.3f]):\t " % (geoRef.poni2_min, geoRef.poni2, geoRef.poni2_max), {1:[geoRef.set_poni2], 3:[ geoRef.set_poni2_min, geoRef.set_poni2, geoRef.set_poni2_max]})
            peakPicker.readFloatFromKeyboard("Enter Rot1 in rad (or rot1_min[%.3f] rot1[%.3f] rot1_max[%.3f]):\t " % (geoRef.rot1_min, geoRef.rot1, geoRef.rot1_max), {1:[geoRef.set_rot1], 3:[ geoRef.set_rot1_min, geoRef.set_rot1, geoRef.set_rot1_max]})
            peakPicker.readFloatFromKeyboard("Enter Rot2 in rad (or rot2_min[%.3f] rot2[%.3f] rot2_max[%.3f]):\t " % (geoRef.rot2_min, geoRef.rot2, geoRef.rot2_max), {1:[geoRef.set_rot2], 3:[ geoRef.set_rot2_min, geoRef.set_rot2, geoRef.set_rot2_max]})
            peakPicker.readFloatFromKeyboard("Enter Rot3 in rad (or rot3_min[%.3f] rot3[%.3f] rot3_max[%.3f]):\t " % (geoRef.rot3_min, geoRef.rot3, geoRef.rot3_max), {1:[geoRef.set_rot3], 3:[ geoRef.set_rot3_min, geoRef.set_rot3, geoRef.set_rot3_max]})
            previous = sys.maxint
    fig3 = pylab.plt.figure()
    xrpd = fig3.add_subplot(111)
    fig4 = pylab.plt.figure()
    xrpd2 = fig4.add_subplot(111)

    t3 = time.time()
    a, b = geoRef.xrpd(peakPicker.data, 1024, basename + ".xy")
    t4 = time.time()
    img = geoRef.xrpd2(peakPicker.data, 400, 360, basename + ".azim")[0]
    t5 = time.time()
    print ("Timings:\n two theta array generation %.3fs\n diff Solid Angle  %.3fs\n\
 chi array generation %.3fs\n\
 corner coordinate array %.3fs\n\
 1D Azimuthal integration: %.3fs\n\
 2D Azimuthal integration: %.3fs" % (t1 - t0, t2 - t1, t2a - t2, t2b - t2a, t4 - t3, t5 - t4))
    xrpd.plot(a, b)
    fig3.show()
    xrpd2.imshow(numpy.log(img - img.min() + 1e-3))
    fig4.show()



    raw_input("Press enter to quit")

if __name__ == "__main__":
    main()
pyfai-0.3.5/scripts/pyFAI-saxs0000755001611600065110000001142111706360143015342 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
""" 
saxs_integrate is the Saxs script of pyFAI that allows data reduction for Small Angle Scattering.

Parameters:
 -p=param.poni         PyFAI parameter file 
 -w=9.31e-11           wavelength (in meter)
 -d=-2                 dummy value for dead pixels
 -dd=-1.1              delta dummy 
 -mask=mask            mask image
 -dark=darkImage       dark current image
 -flat=flatImage       name of the file containing the flat field       
 -background=filename  name of the file containing the background
 -h                    print help and exit
 
    Usage:
python saxs_integrate.py -p=param.poni -w=0.154e-9 file.edf file2.edf file3.edf
"""
__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "30/11/2011"

import os, sys, time
import fabio
import pyFAI
from pyFAI import AzimuthalIntegrator


if __name__ == "__main__":
    paramFile = None
    processFile = []
    wavelength = None
    dummy = None
    delta_dummy = None
    integrator = AzimuthalIntegrator()
    for param in sys.argv[1:]:
        if param.startswith("--"):
            param = param[1:]
        if param.startswith("-p="):
            paramFile = param.split("=", 1)[1]
        elif param.startswith("-w="):
            wavelength = float(param.split("=", 1)[1])
        elif param.startswith("-d="):
            dummy = float(param.split("=", 1)[1])
        elif param.startswith("-dd="):
            delta_dummy = float(param.split("=", 1)[1])
        elif param.startswith("-mask="):
            integrator.maskfile = param.split("=", 1)[1]
        elif param.startswith("-flat="):
            integrator.flatfield = param.split("=", 1)[1]
        elif param.startswith("-dark="):
            integrator.darkcurrent = param.split("=", 1)[1]
        elif param.startswith("-background="):
            integrator.background = param.split("=", 1)[1]
        elif param.startswith("--version"):
            print(pyFAI.version + os.linesep)
            sys.exit(0)
        elif param.find("-h") in [0, 1]:
            print(__doc__)
            sys.exit(0)
        elif os.path.isfile(param):
            processFile.append(param)

    if paramFile and processFile:
        integrator.load(paramFile)
        if wavelength is not None:
            integrator.wavelength = wavelength
        print integrator
        if integrator.maskfile is not None:
            fabiomask = fabio.open(integrator.maskfile)
            if  isinstance(fabiomask, fabio.fit2dmaskimage.fit2dmaskimage):
                mask = 1 - fabiomask.data
            else:
                mask = fabiomask.data
        else:
            mask = None

        for oneFile in processFile:
            t0 = time.time()
            fabioFile = fabio.open(oneFile)
            outFile = os.path.splitext(oneFile)[0] + ".dat"
            if fabioFile.nframes > 1:
                res = integrator.saxs(data=fabioFile.data,
                                nbPt=min(fabioFile.data.shape),
                                dummy=dummy,
                                delta_dummy=delta_dummy,
                                filename=outFile,
                                mask=mask,
                                variance=fabioFile.next().data,
                                method="BBox")
            else:
                res = integrator.saxs(data=fabioFile.data,
                                nbPt=min(fabioFile.data.shape),
                                dummy=dummy,
                                delta_dummy=delta_dummy,
                                filename=outFile,
                                mask=mask,
                                method="BBox")
            t1 = time.time()

            print("Integration took %6.3fs %s --> %s" % (t1 - t0, oneFile, outFile))

    else:
        print(__doc__)

pyfai-0.3.5/calibration/0000755001611600065110000000000011706351114014267 5ustar  kieffersoftpyfai-0.3.5/calibration/ref-sample.ods0000644001611600065110000010140111665234773017045 0ustar  kieffersoftPK}?l9..mimetypeapplication/vnd.oasis.opendocument.spreadsheetPK}?IbPPmeta.xml

    
    4
    PT6M1S
    LibreOffice/3.4$Unix LibreOffice_project/340m1$Build-302
    2011-11-29T18:13:11
    
  2011-11-29T21:00:58PK}?settings.xmlQs8S0~'	tN/ܥmܵo^@Yd+۸vK3~ljJջG $E>4gAи[|h_F]jE\tjKPJ?"[9Vr{h[H$'HK9fӧXrQ046JiaxX``wG+>TSSP q&6t.;$4=c!MxQlZˑkCCQ3=osO%]2 &u̟E^$|+UU
P5E	_dVTv^D#uw:AЫP+*ft$zOXUMH)T7-hKD#%Wι빢7dү5nڦd<7xns>KAPtC
_ECV]k^
G cK"
R6	vtE&íeGQ%42˗g!P%]nN9R"Cf
nWЯ5DHz9@\7Js(F9;oLڐp+1bs/pNlGW1ܿt[Y
Xy;XtKe;_6u#;~׫/?S\:%+7ns/lWй]еx>Ok3]Щp9%v}goxeϿyrg7_>7E/'7~z_??^|uO>]O7O|}eO{?=}_~/>w%]]T}݋OzK>kGzWwj.n/>ח7no0͝g95?qw*q.n=2_x׿ݼ~v_գ'/ի߿zq1߻W/uGGOƯ}KC{Ń?9o}_~G^>x'?O^<\ EJ/_\]߾b;hg7/㏾<4EO.[>ËN'O߬}
O/.8>!;8ܔۏ}o#ןm/졯÷?__<|ӛ_+.|^ݟuh=y7?Z~zgȻ/ne~Co7yÏW݆zvc={_g7mf|fxŋ'xa>^_^<^k_Gsח_~uY>o˓zl|󋗷6	osG닗OoC!zu"͋~E~7\҇?7'&v|>(}u\]|j~޼#g~p?
WO?zom<]_8_=zЫǗk=+`ϿSot=^=9z{_]ݚΝ=xß7otx'/~k7߾Ig]~vA~q_?{>΂93wLcStIᢸzi.ll&6[L	?
at']u:73?yc8xKs&#LO$i>v)nM:ǎp'*Oc7'yece]O|o}w+i&6c/8ls4ἋK<ãZ׆o//o.Yqsyz7G7]>yr䏗o+=Ӌ.޼\_~coOZzpx׿vc[%g}&~W_o/}-
k`z-zKWj\U+yc'76 /./W}]ރ	x/7:=+/}l_͸{O.n?,_~^PSzQu:O{o>.?wW{sX!?8/[to`ZӋg_=ٯb_ǖ+y: Qy0YOʓ9b=?wVya&/-׿xN]xepy7:??i>>Fv|_|7ٯ~[χ?-B*\嬍[a2Kp>of%5f&\Lf	\ci 42#tG@Q<rR
pU䖍|}ƼT,;%Of	2?"dPt2,CT*+g2r,q"\}Lf]X_edsN4)K“YfXgLޟ	3bm*;m74TeXQJ~NnYfj2FFL0˴>YC^>"ٷp-~/ȼf	
(D'z䳲L-eu	TQm؍Mfyw_f8D3}/>Hf$2SεьLfYߙ	PgƈMIl1Y֧( H+⌥w7ar4DEd04c6iFB4-֧
yh&wO摛eu	*%)pRms(dge(%Wf>ZNnYeZ"&l֭,8@xt{u뻿{g+Hr$qkMHy-",3|wEt墈JKHX+tS,3 j\',[Ct袈8et	+.,38wPv-fw.&?)Yn{q[Dhyq}G+W+|o.rNfY?;4cF<(LO+Ubcvi}@4"n.F4$N-7iUU3A,  
Ih)`rDE.iUdG&2ZJZ~}r
uF613ئfVʵXzQQ6AD&&s+Y'yGmCgmb^;0CPP*dWx“[gD-2l
}Ahe(b
3^'Ce2QDO/jn=۸elsGQ;e

R
-Bj"c5*Ҥ۶NnY_ED8=ܓM>t 'T9'y2RTQ?Tg
A٫R2J-*Dy\JDaVkq,\/B"fXz\ADFBNK4G,]\MLV݋`SĕslJ7[V("wp''dE@aDhF32MэZl4*H7z"tuySq3Kb함].YfH囨^۶NQޫ^Ci@*.97٣LfY4)< 5~wd}'}@61y3ti'6@6A)d?Cdydlcy.:l8e|ET֬ 1.4y|vH+]u7n'$Iu/7A)* -MR*R[("JYJ&@̞!,.6|B Ipxl-3fܲ>!Nz%?}kܲ>Yle[Ͼ
nhnXfև8e|fީ1[4b>6l}٢)^f*
qI)b!-M&hT*ՌLnYo.UhCz]@?c'CTz@T*aޑy3@QHMS#LsKu28J,Iv,3lIg.q&gݹ>0&ǸS6PWw!Ox^:|AH|h%T-2LΔГPFG''cu]ʅ\FՂ~MfgWiqpŤ1F--e`1[ad
DyAHlsٵ3MɂMe@Qi+e$"O7YW&(Lf)Ĵ}N:76QiEg	Ne $ٖ&y"NfD"XW`ܲ>D]IٜVCyl}ML}CŝKTwzhQ r>4˨{7QHR^9|1+.)߄q*0*Чx1OfYoӮ$)4==dC|3SAcuig%|%NXXa
!3yĒlq@}a7"[aiJA>>,3$yvn2lmNnOg%ƾNu%*(ڲ2eگQHsC*qļ^WU՛v^dsZӮRZu	]8]ML]:iEOOy%(|XG!l@*0]G*,mGHF\[vA$wb>#`iwǠshEMdzA63IFkQD4V	xFkQAwMrA5ܫh-e9Tn}
BhTAU,F>EQb$
ۻo,뗎"JӶMn؅Ą8]o`~	JV#Ѣ-8~WoY6#QDlaz;?܄:Ksy$*2z?4,;%WbMIPtE"vyAE[f-I̙MDCY6p6JȊrjx([u[cgn[3y$\eneur<E-j2T3oYFUcz޳9gC-IRcڭNt/BJ:dˆ<PcJ?rEKT0ܒPiIn^~}Hbྚf]$DiD`ˮʥD9'ϣ0p-'O]I
(:7)D}Z(,$F!@mGmw&lJ0Ւ";Ae2rfG$
2kyhhT[:KRuQV&5ܲ>!RX'O%QH%UTJ*N$ĭHݯt~*ٿ7
]^oIj-SI%X	u&T'̬YJbbܾ%iݺ_yR)Fi8Xh^t0$N$F"ZuXw'O%QHD*eTYsO%F!c	J
l@mi
3Ix"TUlPoLû_b:ݾ~wYB	)Bp2 y
ܲ%	 em	I@p[V!IB-p":YflGC1p_D4ւ_?JQhaGqHBE7=tY?)IRGq8,<סTo`=wTTՁںSԌB8;O%aH^e4Wj}	CԌHK3Ad2>>,vZ%d(_w	3ejju$%*蘖m2GaH<$"l:z%n'ĄEua._pXw޺Cp dLe(@>$T)W60@'Jbܾwi;ܒTenRŊB_ם[֧($*3g'w0{!i€J@%n'Ĕue._sEE%lݹe}*	C„x:$#NnYJ4UDUmP*nا2b`I*ٿ27
]V{!:;O%aH5!r͵!-SIykдO'+`+O"
DmPjK6[!^lnKm&?V,y2m+.TLFYں/#B]dנzq9e}*IRp(J&,W(D!iR
2_IOl>ý8gv*iPI%Q2	Ăj3rw3Ǩ$TIZ+-y2T9AU6,*a>vZLۻuinۿ47
םmvqݙeTs5f4='lJ
hmJbܾi%d(_wXXyu$R΅an$ɨrRį*1˽:#n1nVaa3gQPj"ʍN>ԉfrq^<{ψ+\>uY,B_G%?L,MfY?Q2IfQ\e,_tҼ`Q	B2V
H0nمtĭNK_J#BuW ӆ8;O%QHjMɏv:HjWBBHWv`'[Jb:>Om]G#B
m\W֯;ܲ>!Q*LQcjzU̲/
	k05dCB<$d)*[uQPk"Z4giCL[֧0$I"g=$ܲ>!FƄ
A_>Ψ-`+
(vϥrr"=
L'O%QHKO<#d
x%AHF%Topε,Ĥ}ۺ4_SKy(OnYJ(قhWB4e}*	B2*lX6{g%|b6T)֥inPMЪ6B~	if8$M̤[V($i
&eC>pLۺٶ.Ks$*VʦLnYJҸHY&3w Kf)Yy'YIb>nI&ٿ27
ZIY-'2e}&BbJcAˎ2MfD@|R*q>$&n֋4RIT09AnYIʰdr.sD%
5*+n'sĴ6wc-@8*(UD
`6P[I1jI?wQbՅ!5ܥzbjޑmWbRO޺ԓ/\R+/*$d(_3>pLɝ4oK.K#ҋJ	1V*3-=tŤMiwK.K	ҋJJiUC,Yvb;j-/[RK/*U+/-2 (YvbR5Ρ>W}jCXhEQҫ
$fRY$&n`iiZzQ-TI
f4.=sŴP}	͹PCXjEC%1[.gs>^L;$ֵCʹKoYK-$o+RK,IL|7J8UΒKos޲ZzQ1KMKm|֠/yR'S&11tיu1_̲0^TTjzyb٧Ebj>q+K.YҋYj*\
̲.Y]p罩;cYxxX^<~unA
}{;oo
c!Vz8t
1`/π>[L'Socu׿׷?/_wx&grnZo|`?S੓?#Ccq$t
_ൻ-TOn9	rŜ*:rliGDPATT:Oނv9DǢ¨:e?)(!arrxmN0!665ct&DHiTr)-SzpB.)R'sKmJ%uP_J&՜VVʓ[֧h%ɠͼ\KKI>O̍7Aj
Pzt%eUnJUNSXKA@ IK{㙞湦69!'Zf)u:e}JBBNՒ\`-sz$PƚY5nYԣ(VdX[֍MfYPisÃSmr;,ӢbOg_%ž2!Z9Lʜ3J+'x$•mC$:e5ƙQD%'JY;ʓ[VΌ"ĔU3ib41Y.0)Hi\`r.4!+ޥ򬿟d@VΕ
t5;OK3gT qCm%ګQ
Lnـg~\`cTa8^-%F!y
^Q(ɦP^U&ٱ+G2O̳b9s.b9mf3
DSIi-Wn2e{$5Ye ͕-ܷFoھl(Wm™?$֦z;M֊uBd¹&AD<Zk
y.KC8 " !i_eC oÜl9sMzl$"
fu,柠sL#9%Ex$sޝ\!@R&lBÅ$&BrD&ېX+m@eE-žw}rdc=Fٷ+.Sڙj	cf&5HIR-`h6)c6WTdrM=Kghb_[6@AHJ)N364gn Tf)cYv}jrWfn^|JfY<ߊ("lur=IP
d=ܣv̩dg`>yr=S'v*z
OnGl5AnU_9Nn)P{,4OL?k-q.K+IO
P{4ER\heDd-!dAj^_- $Nn99k߼'l 3ȵ@]$YRah503{%QDm.*Yl >Sɭje|zY:]EsLc[KPi3MJ̲:J䖩;L		W׶a+T;׹BҔU3q\
8$ٚ({GܲͲ}{ߕci};GM3dބyܧLbT5LW̲%	"> eESlr%sƹgv7lIRv[G,?8[e-?uѤ*J@y[(e2Nģ<ǒ~(gS6w֣Z5^A؄jQ#APj	j3*
>EMfGqj%vb_YSbP{0MEɸx<ڃzJ۫Dƃf@0$L5{K"'ܲjBdr2 P'%7;m;x[L'캿K<">]vD xG-`s/;\KZϹ2a8 Pn@=DmADi'\Yt*XЃ[]g,9*^aZxiܠhi?%:":Bu*mܲW8I(J_ ,Y9g69mqP\a,Z(F%5A`E'ln2%T8z'RL\4U3>U21ùlQ*Q*V4ej=ו#R$E#"F5Tmڍ:#Vpoq/=m]R
_5Ov~@F@K0IJd
-hDYmjjx}`j%h4=ҵJUr-şҥ؝槜ğ'e0/"	ڟe-3f{z;Z,|^ܰ>aFY۸~}GBC5+C
0ιMF,	,뽞we2N=XZ_|;?c] TWB!JSoY1"ia}[z=6e}ŒN>L.n[_p23P+Y4zUy3*4$N-*t"aF3%ּ,'On-/X܇C)D#OQD"4,a~hqy_VqLl ,&q",Bb3̾Z%OfO,9N5*溴MNeuʌB3)TbO0qFuE}F4>G=3)3<02kmeeHeFUIhH97^d}dX:PJl2	y%d=e-SfLa)YOA#R/!^}m$;D%7@闈`CmcL7Ϙ6#cernz~ƌ\`MY
3	<Fu-3fKQo'yϘ~hɃ+QqFLƧ_bf{j(-Sf4GkpPur>)3S
w/IѤ<Q֫2)3ڰ+{V%CWp#OQD`1_R
-Sfx%94a!'7Ϙ<\e
iy'XZo=FS.J],*A^[' 4k1s&!ϗQ@~QOfpnDexyӌϐ3>~j(aay%aaK'hE)IJQ3e-f\e"m}[g([1i;O7؀~	jV$#ce}ƌw2 R
_`O^W{ڜ\0Yci@a[' 4
\ 7Ћ['(WZe0mK<l0Х֧x*$U{#Oi'X})?5sQsjՋOjzfR3TMbRf%l"^Yi2iWنz2EP4~b@&o}f,S9h7dkϹF+e}BcO5<ЋY6aF5#%Z?/Mxb~%>C1[ghk'Af=N]2c)?%)3sQ%5~'IfOAhF0?u[a)3$T\6fx;LeeT(dRy9}Rf,[Oh΅nDԡqΰ:aF'4"N1=gdcF$	UJ}:?\px͈42a( $>bn%_R,ߧ'H\/		
{d(OH:3`h^OF~135B/awZ7y3:'}"*o[I~h	?LPXD"VdxH(Tw.5FA"4Q.ܲ>5F{\QQbim*ul}(3CT-Rc	=WSt"
"
#bgJjGʅ urrep_uj&lHE0Pi̲CrZDGm@2wkzehz6,L)65e˴vgP01``DAIB]0"Yi75qՂzRc4z:ME܆w4e}j6:X^,F+5i#BPޣُϸ"2jl-ƅ/ihKTD5,Xe^۩KiwNOB0KM=nܲ>55lh|,,PG5ExGi3F3aza	464f4'r
,BO);c0QilAjgD!'Y&R2F$fYNrÈ8y$UhIzN.0tn[V(ʛPy2st5r,ߵVqOτB0"xZ,\X͈-Sc$V%3Z< 8ʌDs1{j%Yw{Bx.|(ji	4r,uni}d'D!T%ǙH̲%L&sQk{Q'>EdԨKam9fY1ȨQ	]iFSñD㴫%q0QF$UZ[őHܲ>5FFrNܰrpOy2z0$N7yr̈́TE	\Ln'72aHz&?&
P82g!OaH~cӽY&OQH@TKik@nY0	wFn'9Ʋa=wUq0Q$8iGL#2/DQz&0<r1ʒ+(-N%P;f~rBI9[	U*=!'[wKK%Z4K=O.ADSFAKR9Ofl|)rds7\ٓmQz	Y&d?KK%'&NP3e l\\<^;<щ
KXNwxڱߒܲ(5Y.lA_#,FW(JN=kBjiKn>J-A@	lųWZ\v2NXV@_i
BLɕ])[4eEɉ<%EdҼ7tyF.fqnLWW6="G!@nɛr&l\(9iC1iAY\y,3jd}FES~sǁQ%[@"Lxr&%RRjK2e}r	"2ra&ɋ@.fy_\b6o]-wG!@UB%vDQJ5s8Y6q+<>/%&n}>?_Ys!܊ZY'J(H#P="иO ")Ule-8p[-1yq?Mǿ$_^JF9fܲIr<(+	_Qr	"jܯ̞03l-$S.jnKoKxr>%ϕ}nx'oٓnˢ6e0JMV@:d\\yW,hb}^DkL+܈ssQf)n87RPW{Y'-Qy%\{iOfgUzs{U%'sml@xp\d26%RZc}+Zoz>Dչ6jH`<7nq>%n-WF!-Xǹ:eEpԪW6Y6@.QybpeZFE1yn/ԭsu($H՛-$(JM5+šQ['<Q/"x#\b^yZ+%e([kI$2eED<)7-Kټ0 yr>%&폱u\ݿ<7
5
.a\_lRBF_FEU3l<7ȅ4!{/Ofةj߁h\ݿ<7
&GY&l[(B?IBe}n	"HXIfu0en]F!R*ͧ
"(HM5ε
:pY֯EdŒX9eWd{M֘:/wZ`$_!RZDj&l\(1'Or[[̓֯$flsYvzj7s{jss91ʭ"@sy2&%0,~[V0$#2ȉ:bXr5f0@O9K<=2eic\(aܲ	BJ9t3e)Y\ĿtzZOEfB0(8726&q.DAL9EDd# 1`㖝LLk.O_ur]1@T\j>Ln&aŸ5+ck^!*ku/^6u7=FU=3QQh/O}7pG⃇9|f[~x|˧0D_hk3~2^۳~&~VGoѥ/WޕIRk1aq<^1A>! !4qܲ>g?j|ر΍Y.q2c\BMTIeRΌ,xн@ s[V,x2JѬd?3NfY%s&Mgēe[,cy]1òےd9Rˡ3U)>Y€,BMmWH,3V6be?_߽é!HHdOUbYZ^vy-Ywi:rZy/HXB<:F|aE"ܑ_ܲ>Ǩ5QUDTssڈst{FќDRPʖaTu+2[]s)Q4adC
nYY
Q9=.y%f)+͔KnõY~4	-Tb.FBswq@#s fe,td,Xۛܫf枞ıy_+DjU$2l{2G񿳝 64er0""
J8fـFlpJX.Yٺ+ƚQ`Pm[eɶW溴q,yKs)0"h{
@1*f(%J훥-8"[Vhka֙SXiF$MQKa?n# yUkV{
4˂TG)0A|g$ԒPnF~粀rAB$82<>6 2nɺ>bpm݆p~Xf$Kl~ᓍaĨXk԰u̬+&c/}sch4C@&nk|0$!?wެhpuR8~Z
7|aEudtuO|_0/@HƷ֬vᓍO89d|BjY$F9? hW%DK/slv(a=pNÁJmd<`鴗x==nEA 9vՋ+KWZkg*y1磬#*]yeK[q?i\1c%ǔ[:Ҝr
 l%ih^.߮|tεs^@qow"{z]gb"YTK3c^>]e|Bd|Bڌj)K#n%*8l)_}^E6{^J#ZRn:R$.+aA~5q	h0x=9ն=(pT`(4-SYˀvOޝhaU	s.9K^%Q]8Jx*Ư|Bvtpla¶kREr"fQ8f;}v8̔W&lF<NK
z՚̰%bzKabkJٌ$nZ^sؕ%	v=М/lM1]u29$Si.3Lwo	lkة^/U$'vIyh)
Z+	m	m|
EC*"$3z;z"9Jt̴`B\jy=Oh[hj&FZE|sED2?b?nޠD^ӻ2,ܿĩ$/%ht}+HT|k1r 껽/:%7gU^em+vJ5ȇYjv6:8ݻ/pԦ/
rչMЗK7wIvǑ\2`6|=G_!MлZ&tEa .JN$`a?}2/;>dA(usWcCP&|A?|mx ÁpXݜ7b#8rp3,oÁi
Y:Vi:!g7n̥
P8Xy+59)G2x\\V-J7E2oІNj7V$sψ%(3DB2MDL#2VJTY!mRtK(Gl<|
$7Vٺļ݋s%'2qcnYP*xր<(y
HlijTvz>DN2SEdLIzjk,(tK,d|BDLgɔI('iaA`{5Z?,(MFCmݳY:2VrMIfԥONJ2tГ*ZEeNduDFͦyX3z8O1,r*:y_d^bE0ݷc›A'A$)Z#?q3FB9͑u?eP¶.y3)8U5i~]ބ3e{
N2[	H/ϔ+?{>H	ۄ!/"ױ6KqmV$Y@	[h!;X=%sH2ۺaA9$st\1}/<.(*}66}uݦ[#6˼+l'ܧ~
ڈhE_N%~
%?|Cp~h>0ݳ T=ʧT2=j۷,*C~,{I˳`fϧ	~z~x
|􃎑y
}p|vshG2RP.hќxï	o}Oh‹?G;Xk$Axc*HXԊyƱ:Xe7Q-XetdJŎI4*Y1/ShITJqPZa
40RW,yFҁHf+Q>kOP:
Q$@##Ռ.ݞj=/>V"7OhC3ɬ߆̃-"	')={Hfw,$$	F}[
A[w-])Pq3t,|g1bd|@NEWq#u˪j;۲QXd>vϟh{/%
{v$x=F2㩥;D2G$3pL~<mа8c,Yx366(v8[ػwX1(scP*h:^"(-_G勽ds7QHHhHNg!˳(piqoI.VTQ;0l{5>g#t;NHTQ.9҈ҵqF,w8)5c|,ɜ'
SH8'%G+oTKT'
'Ds[{r{hkP8፩X QTZQ5ʕAyV>.Zau6R,Lh6 <Z""ZyQi%̧dWqI2SK2/NA$f	mh#эVu*ɩ/t$La3ɬծSD-ɌXi`MfYl*sTNڱ:JLsҼáw%kE"v
5V:,2"ф;KF2A'a=[y.1.Yx
D2oІB^
- gms$/Z>dv,.Ujdϰ++tpCI"!"\ÝU?KS5<~]-HhKm/ >#6XZ$srd2$ŢLK$sb~CE!$Yx3|_u..8֘)n63	9 eRP!]p}K3,>VtٌhS_28`$.3D*;rm̅:1)qB5sf*E1C,0)7:z'g@ہN;lٳTaZd~qqəH(P;,9ɟ(r<}Y]ZY ڠw240idF{csG24yVV!OIHQWI4ڸ|"Oe$sb{%GqExԄ@I(Yx36d>ZHf.vP/m<|<\kP8Yp"Y/U ]Y87.Cnokz*$3nyW6yYf+FK]%9O"OdlpUd:C6Jȑvr:If%#&y\!m/|ndxY_Hf  h!Q]0ţ@B2G=g/-%Gъy#`6\G$а{$\1v#|kP LSR7I:`H^&Գ)cqCS# ~0!U4$ʱ8zE2d)
L Rќ=P4VR2>
2>

Q[_
bKK63D;y0mXpP@-'))C|${If|]`	c&K0[]t|dX_=j@^l_t_w# Q3f2	NBx/ɌxηA$Y:\x/OjyY,d|BI擏&%{%Kiby^!Bn
%Ft5W3OJO]$.Dûg2%D2uy/Ly(XHm&e#%
Q"K'Mne|"qSk)WI!]b;D2oE2dH4ct5")WRBQ6;Iz"""%+j#ϒ;CY6D$sd
AS))l,b7̲<jH&UEX0	c{lDFfGB2

;H2[3H7ǐ̹"= Y	g=$
YqQLʋd>$fM'
Xi6./p
m$x	J2'GK(A[5h]ѽdNIfjd!9UT2͑`7
iꨢWG2[Qx@d>vXj)vțWd.vHßHొD2oІ6yh{lfK2'VG.qF2kk*jY6cN2G_B;ŶL`kg(UХ dỌ}<5̆v8^*QQ3Ɍ̲͑F2ӆڵՑ4xqhD5xzq LYi$61tã"NV˩h/Y
4j+c*K5ef{-lt٫ak}9RPEטHH&
Li|-jqCvt‡hg=îy)KT=jyul1$666 UEyIENDB`PK}?Configurations2/images/Bitmaps/PK}?Configurations2/popupmenu/PK}?Configurations2/toolpanel/PK}?Configurations2/statusbar/PK}?Configurations2/progressbar/PK}?Configurations2/toolbar/PK}?Configurations2/menubar/PK}?Configurations2/floater/PK}?'Configurations2/accelerator/current.xmlPKPK}?
styles.xmlZr6ߧ3uloH.phgH	-{Ul#˻Y~yT}IuI(X9߹hmXs<4`!p9W?("^,(RL]siЛKtPNE)"XS#(MWິb6d.r*,i]$P'9@]e'g&9X#>9*T9)]O%
Nnjt]1V*t+sg5vD`^%A8KHͥӃO\3EeH4;T"MKUhð
PP4ΆF/*Py~,θr#%4c3{e^	A8Hՙ.jϒ.B@JYwDž_ Z/{b=Qw]l|@qj&-beyoCYI9ͥa8NKNơpA 684Vq+CeY$a K^Tk8b(@1,aVP7/출-v&)c fTh6^^v!"+КUW[_DjurjOSr-U>:
\Hb(_`\ԣ`wyƋ
K`{k3Xϕa-pf{nvcΊL}5BOJ_	!Ay%*uJʩNV1eUӐ~?z0ϖU,KJ>Frp%`-=}r;Uz>Y_^+{
']jf~8~TbTF~%s;,|qYO#ɡKDF4{`rp%BDP]ٰr[6?&gE4UvCoO'0#㢢S'gs_Dnrtc$Ʉ@_'ҥ Sd%䳜9̈́=9wfɨEpL3-E?j_^3`QOdc휍P,5#-p̗?V3Nh-OT?6OP(Pj|OT0kgbyLXEqvHֺP>99r%IF	FJ-Lu/I%}wzx=ECOPۊFYu[WQfI
$NNUv@QusS~E,;f*r?5"[Qb]z==ja+h.\ձZf'~T
̄|M{N&Do#E1fGO+Sd(ԿjWozFu5j,_ҠIHIwhXR%:c&
"Tl+WJ+$peg'}Ӵցꊽ@rvWPKx3!PK}?META-INF/manifest.xmlSn +"	5aҾF	¦j~IIԛ=cٝElij|þE춫M0: ؈QGC4hKd5_J2Uu뜇z%;@LCFjuV䵲t$/]NPBejl6[6r}$)8)z8A%o%|qC9eߧr5bu2ւƬl}_1*8⤽Ο77~PKĊPK}?l9..mimetypePK}?IbPPTmeta.xmlPK}?-settings.xmlPK}?s-qUxcontent.xmlPK}?A0^Thumbnails/thumbnail.pngPK}?tConfigurations2/images/Bitmaps/PK}?NtConfigurations2/popupmenu/PK}?tConfigurations2/toolpanel/PK}?tConfigurations2/statusbar/PK}?tConfigurations2/progressbar/PK}?0uConfigurations2/toolbar/PK}?fuConfigurations2/menubar/PK}?uConfigurations2/floater/PK}?'uConfigurations2/accelerator/current.xmlPK}?x3!
)vstyles.xmlPK}?Ċ\}META-INF/manifest.xmlPK6~pyfai-0.3.5/test/0000755001611600065110000000000011706351366012770 5ustar  kieffersoftpyfai-0.3.5/test/testAzimuthalIntegrator.py0000644001611600065110000002624311703641246020242 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
"test suite for Azimuthal integrator class"

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "17/10/2011"


import unittest
import os
import numpy
import logging, time
import sys
import fabio
force_build = False
for opts in sys.argv[1:]:
    if opts in ["-d", "--debug"]:
        logging.basicConfig(level=logging.DEBUG)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-i", "--info"]:
        logging.basicConfig(level=logging.INFO)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-f", "--force"]:
        force_build = True
        sys.argv.pop(sys.argv.index(opts))
logger = logging.getLogger("testAzimuthalIntegrator")

try:
    logger.debug("tests loaded from file: %s" % __file__)
except:
    __file__ = os.getcwd()
    logger.debug("tests loaded from file: %s" % __file__)

from utilstest import UtilsTest, Rwp
if force_build:
    UtilsTest.forceBuild()
pyFAI = sys.modules["pyFAI"]
from pyFAI.azimuthalIntegrator import AzimuthalIntegrator
if logger.getEffectiveLevel() <= logging.INFO:
    import pylab

class test_azim_halfFrelon(unittest.TestCase):
    """basic test"""
    fit2dFile = '1460/fit2d.dat'
    halfFrelon = "1464/LaB6_0020.edf"
    splineFile = "1461/halfccd.spline"
    poniFile = "1463/LaB6.poni"
    ai = None
    fit2d = None

    def setUp(self):
        """Download files"""
        self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
        self.halfFrelon = UtilsTest.getimage(self.__class__.halfFrelon)
        self.splineFile = UtilsTest.getimage(self.__class__.splineFile)
        self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
        data = open(self.poniFile).read()
        open(self.poniFile, "w").write(data.replace(" halfccd.spline", " " + self.splineFile))
        self.fit2d = numpy.loadtxt(self.fit2dFile)
        self.ai = AzimuthalIntegrator()
        self.ai.load(self.poniFile)
        self.data = fabio.open(self.halfFrelon).data
        if not os.path.isdir("tmp"):
            os.mkdir("tmp")

    def test_numpy_vs_fit2d(self):
        """
        Compare numpy histogram with results of fit2d
        """
#        logger.info(self.ai.__repr__())
        tth, I = self.ai.xrpd_numpy(self.data,
                                     len(self.fit2d), "tmp/numpy.dat", correctSolidAngle=False)
        rwp = Rwp((tth, I), self.fit2d.T)
        logger.info("Rwp numpy/fit2d = %.3f" % rwp)
        if logger.getEffectiveLevel() == logging.DEBUG:
            logger.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('Numpy Histogram vs Fit2D: Rwp=%.3f' % rwp)
            sp = fig.add_subplot(111)
            sp.plot(self.fit2d.T[0], self.fit2d.T[1], "-b", label='fit2d')
            sp.plot(tth, I, "-r", label="numpy histogram")
            handles, labels = sp.get_legend_handles_labels()
            fig.legend(handles, labels)
            fig.show()
            raw_input("Press enter to quit")
        assert rwp < 11

    def test_cython_vs_fit2d(self):
        """
        Compare cython histogram with results of fit2d
        """
#        logger.info(self.ai.__repr__())
        tth, I = self.ai.xrpd_cython(self.data,
                                     len(self.fit2d), "tmp/cython.dat", correctSolidAngle=False, pixelSize=None)
#        logger.info(tth)
#        logger.info(I)
        rwp = Rwp((tth, I), self.fit2d.T)
        logger.info("Rwp cython/fit2d = %.3f" % rwp)
        if logger.getEffectiveLevel() == logging.DEBUG:
            logger.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('Cython Histogram vs Fit2D: Rwp=%.3f' % rwp)
            sp = fig.add_subplot(111)
            sp.plot(self.fit2d.T[0], self.fit2d.T[1], "-b", label='fit2d')
            sp.plot(tth, I, "-r", label="cython")
            handles, labels = sp.get_legend_handles_labels()
            fig.legend(handles, labels)
            fig.show()
            raw_input("Press enter to quit")
        assert rwp < 11

    def test_cythonSP_vs_fit2d(self):
        """
        Compare cython splitPixel with results of fit2d
        """
        logger.info(self.ai.__repr__())
        pos = self.ai.cornerArray(self.data.shape)
        t0 = time.time()
        logger.info("in test_cythonSP_vs_fit2d Before SP")

        tth, I = self.ai.xrpd_splitPixel(self.data,
                                     len(self.fit2d), "tmp/cythonSP.dat", correctSolidAngle=False)
        logger.info("in test_cythonSP_vs_fit2d Before")
        t1 = time.time() - t0
#        logger.info(tth)
#        logger.info(I)
        rwp = Rwp((tth, I), self.fit2d.T)
        logger.info("Rwp cythonSP(t=%.3fs)/fit2d = %.3f" % (t1, rwp))
        if logger.getEffectiveLevel() == logging.DEBUG:
            logger.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('CythonSP Histogram vs Fit2D: Rwp=%.3f' % rwp)
            sp = fig.add_subplot(111)
            sp.plot(self.fit2d.T[0], self.fit2d.T[1], "-b", label='fit2d')
            sp.plot(tth, I, "-r", label="cython")
            handles, labels = sp.get_legend_handles_labels()
            fig.legend(handles, labels)
            fig.show()
            raw_input("Press enter to quit")
        assert rwp < 11


    def test_cython_vs_numpy(self):
        """
        Compare cython histogram with numpy histogram
        """
#        logger.info(self.ai.__repr__())
        data = self.data
        tth_np, I_np = self.ai.xrpd_numpy(data,
                                     len(self.fit2d), correctSolidAngle=False)
        tth_cy, I_cy = self.ai.xrpd_cython(data,
                                     len(self.fit2d), correctSolidAngle=False)
        logger.info("before xrpd_splitPixel")
        tth_sp, I_sp = self.ai.xrpd_splitPixel(data,
                                     len(self.fit2d), correctSolidAngle=False)
        logger.info("After xrpd_splitPixel")
        rwp = Rwp((tth_cy, I_cy), (tth_np, I_np))
        logger.info("Rwp = %.3f" % rwp)
        if logger.getEffectiveLevel() == logging.DEBUG:
            logging.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('Numpy Histogram vs Cython: Rwp=%.3f' % rwp)
            sp = fig.add_subplot(111)
            sp.plot(self.fit2d.T[0], self.fit2d.T[1], "-y", label='fit2d')
            sp.plot(tth_np, I_np, "-b", label='numpy')
            sp.plot(tth_cy, I_cy , "-r", label="cython")
            sp.plot(tth_sp, I_sp , "-g", label="SplitPixel")
            handles, labels = sp.get_legend_handles_labels()
            fig.legend(handles, labels)
            fig.show()
            raw_input("Press enter to quit")

        assert rwp < 3

class test_flatimage(unittest.TestCase):
    """test the caking of a flat image"""
    epsilon = 1e-4
    def test_splitPixel(self):
        data = numpy.ones((2000, 2000), dtype="float64")
        ai = AzimuthalIntegrator(0.1, 1e-2, 1e-2, pixel1=1e-5, pixel2=1e-5)
        I = ai.xrpd2_splitPixel(data, 2048, 2048, correctSolidAngle=False, dummy= -1.0)[0]
#        I = ai.xrpd2(data, 2048, 2048, correctSolidAngle=False, dummy= -1.0)

        if logger.getEffectiveLevel() == logging.DEBUG:
            logging.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('cacking of a flat image: SplitPixel')
            sp = fig.add_subplot(111)
            sp.imshow(I, interpolation="nearest")
            fig.show()
            raw_input("Press enter to quit")
        I[I == -1.0] = 1.0
        assert abs(I.min() - 1.0) < self.epsilon
        assert abs(I.max() - 1.0) < self.epsilon

    def test_splitBBox(self):
        data = numpy.ones((2000, 2000), dtype="float64")
        ai = AzimuthalIntegrator(0.1, 1e-2, 1e-2, pixel1=1e-5, pixel2=1e-5)
        I = ai.xrpd2_splitBBox(data, 2048, 2048, correctSolidAngle=False, dummy= -1.0)[0]
#        I = ai.xrpd2(data, 2048, 2048, correctSolidAngle=False, dummy= -1.0)

        if logger.getEffectiveLevel() == logging.DEBUG:
            logging.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('cacking of a flat image: SplitBBox')
            sp = fig.add_subplot(111)
            sp.imshow(I, interpolation="nearest")
            fig.show()
            raw_input("Press enter to quit")
        I[I == -1.0] = 1.0
        assert abs(I.min() - 1.0) < self.epsilon
        assert abs(I.max() - 1.0) < self.epsilon

class test_saxs(unittest.TestCase):
    saxsPilatus = "1492/bsa_013_01.edf"
    maskFile = "1491/Pcon_01Apr_msk.edf"
    maskRef = "1490/bioSaxsMaskOnly.edf"
    maskDummy = "1488/bioSaxsMaskDummy.edf"
    poniFile = "1489/bioSaxs.poni"
    ai = None

    def setUp(self):
        self.edfPilatus = UtilsTest.getimage(self.__class__.saxsPilatus)
        self.maskFile = UtilsTest.getimage(self.__class__.maskFile)
        self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
        self.maskRef = UtilsTest.getimage(self.__class__.maskRef)
        self.maskDummy = UtilsTest.getimage(self.__class__.maskDummy)
        self.ai = AzimuthalIntegrator()
        self.ai.load(self.poniFile)
        if not os.path.isdir("tmp"):
            os.mkdir("tmp")

    def test_mask(self):
        """test the generation of mask"""
        print self.edfPilatus
        data = fabio.open(self.edfPilatus).data
        mask = fabio.open(self.maskFile).data
        assert abs(self.ai.makeMask(data, mask=mask).astype(int) - fabio.open(self.maskRef).data).max() == 0
        assert abs(self.ai.makeMask(data, mask=mask, dummy= -2, delta_dummy=1.1).astype(int) - fabio.open(self.maskDummy).data).max() == 0

def test_suite_all_AzimuthalIntegration():
    testSuite = unittest.TestSuite()
    testSuite.addTest(test_azim_halfFrelon("test_cython_vs_fit2d"))
    testSuite.addTest(test_azim_halfFrelon("test_numpy_vs_fit2d"))
    testSuite.addTest(test_azim_halfFrelon("test_cythonSP_vs_fit2d"))
    testSuite.addTest(test_azim_halfFrelon("test_cython_vs_numpy"))
    testSuite.addTest(test_flatimage("test_splitPixel"))
    testSuite.addTest(test_flatimage("test_splitBBox"))
#This test is known to be broken ...
#    testSuite.addTest(test_saxs("test_mask"))

    return testSuite

if __name__ == '__main__':

    mysuite = test_suite_all_AzimuthalIntegration()
    runner = unittest.TextTestRunner()
    runner.run(mysuite)
pyfai-0.3.5/test/__init__.py0000644001611600065110000000000011663775650015077 0ustar  kieffersoftpyfai-0.3.5/test/utilstest.py0000644001611600065110000001542711661262227015410 0ustar  kieffersoft#!/usr/bin/env python
# coding: utf8
#
#    Project: pyFAI tests class utilities
#             http://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id:$"
#
#    Copyright (C) 2010 European Synchrotron Radiation Facility
#                       Grenoble, France
#
#    Principal authors: Jérôme KIEFFER (jerome.kieffer@esrf.fr)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jérôme Kieffer"
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__data__ = "2011-10-17"
import os, imp, sys, subprocess, threading
import distutils.util
import logging
import urllib2
import bz2
import gzip
import numpy
logger = logging.getLogger("pyFAI.utilstest")

class UtilsTest(object):
    """
    Static class providing useful stuff for preparing tests.
    """
    timeout = 60        #timeout in seconds for downloading images
    url_base = "http://forge.epn-campus.eu/attachments/download"
    test_home = os.path.dirname(__file__)
    name = "pyFAI"
    image_home = os.path.join(test_home, "testimages")
    if not os.path.isdir(image_home):
        os.makedirs(image_home)
    platform = distutils.util.get_platform()
    architecture = "lib.%s-%i.%i" % (platform,
                                    sys.version_info[0], sys.version_info[1])
    pyFAI_home = os.path.join(os.path.dirname(test_home),
                                        "build", architecture)
    logger.info("pyFAI Home is: " + pyFAI_home)
    if "pyFAI" in sys.modules:
        logger.info("pyFAI module was already loaded from  %s" % sys.modules["pyFAI"])
        pyFAI = None
        sys.modules.pop("pyFAI")
    if not os.path.isdir(pyFAI_home):
        logger.warning("Building pyFAI to %s" % pyFAI_home)
        p = subprocess.Popen([sys.executable, "setup.py", "build"],
                         shell=False, cwd=os.path.dirname(test_home))
        logger.info("subprocess ended with rc= %s" % p.wait())

    pyFAI = imp.load_module(*((name,) + imp.find_module(name, [pyFAI_home])))
    sys.modules[name] = pyFAI
    logger.info("pyFAI loaded from %s" % pyFAI.__file__)


    @classmethod
    def forceBuild(cls):
        """
        force the recompilation of pyFAI
        """
        logger.info("Building pyFAI to %s" % cls.pyFAI_home)
        p = subprocess.Popen([sys.executable, "setup.py", "build"],
                         shell=False, cwd=os.path.dirname(cls.test_home))
        logger.info("subprocess ended with rc= %s" % p.wait())
        pyFAI = imp.load_module(*((cls.name,) + imp.find_module(cls.name, [cls.pyFAI_home])))
        sys.modules[cls.name] = pyFAI
        logger.info("pyFAI loaded from %s" % pyFAI.__file__)




    @classmethod
    def timeoutDuringDownload(cls):
            """
            Function called after a timeout in the download part ... 
            just raise an Exception.
            """
            raise RuntimeError("""Could not automatically download test images!
If you are behind a firewall, please set the environment variable http_proxy.
Otherwise please try to download the images manually from
""" + cls.url_base)


    @classmethod
    def getimage(cls, imagename):
        """
        Downloads the requested image from Forge.EPN-campus.eu
        @param: name of the image. 
        For the RedMine forge, the filename contains a directory name that is removed 
        @return: full path of the locally saved file
        """
        baseimage = os.path.basename(imagename)
        logger.info("UtilsTest.getimage('%s')" % baseimage)
        fullimagename = os.path.join(cls.image_home, baseimage)
        if not os.path.isfile(fullimagename):
            logger.info("Trying to download image %s, timeout set to %ss"
                          % (imagename, cls.timeout))
            if "http_proxy" in os.environ:
                dictProxies = {'http': os.environ["http_proxy"]}
                proxy_handler = urllib2.ProxyHandler(dictProxies)
                opener = urllib2.build_opener(proxy_handler).open
            else:
                opener = urllib2.urlopen

#           Nota: since python2.6 there is a timeout in the urllib2
            timer = threading.Timer(cls.timeout + 1, cls.timeoutDuringDownload)
            timer.start()
            logger.info("wget %s/%s" % (cls.url_base, imagename))
            if sys.version > (2, 6):
                data = opener("%s/%s" % (cls.url_base, imagename),
                              data=None, timeout=cls.timeout).read()
            else:
                data = opener("%s/%s" % (cls.url_base, imagename),
                              data=None).read()
            timer.cancel()
            logger.info("Image %s successfully downloaded." % baseimage)

            try:
                open(fullimagename, "wb").write(data)
            except IOError:
                raise IOError("unable to write downloaded \
                    data to disk at %s" % cls.image_home)

            if not os.path.isfile(fullimagename):
                raise RuntimeError("Could not automatically \
                download test images %s!\n \ If you are behind a firewall, \
                please set the environment variable http_proxy.\n \
                Otherwise please try to download the images manually from \n \
                %s" % (cls.url_base, imagename))

        return fullimagename


def Rwp(obt, ref, comment="Rwp"):
    """          ___________________________   
    Calculate  \/     4 ( obt - ref)²
               V Sum( --------------- )
                        (obt + ref)²
    
    This is done for symmetry reason between obt and ref  
    
    @param obt: obtained data
    @type obt: 2-list of array of the same size
    @param obt: reference data
    @type obt: 2-list of array of the same size
    @return:  Rwp value, lineary interpolated
    """
    ref0, ref1 = ref
    obt0, obt1 = obt
    big0 = (list(obt0) + list(ref0))
    big0.sort()
    big0 = numpy.unique(big0)
    big_ref = numpy.interp(big0, ref0, ref1, 0.0, 0.0)
    big_obt = numpy.interp(big0, obt0, obt1, 0.0, 0.0)
    big_mean = (big_ref + big_obt) / 2.0
    big_delta = (big_ref - big_obt)
    non_null = abs(big_mean) > 1e-10
    return numpy.sqrt(((big_delta[non_null]) ** 2 / ((big_mean[non_null]) ** 2)).sum())

pyfai-0.3.5/test/test_all.py0000755001611600065110000000502211703641246015147 0ustar  kieffersoft#!/usr/bin/env python
# coding: utf8
#
#    Project: pyFAI tests class utilities
#             http://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id:$"
#
#    Copyright (C) 2010 European Synchrotron Radiation Facility
#                       Grenoble, France
#
#    Principal authors: Jérôme KIEFFER (jerome.kieffer@esrf.fr)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
"""
Test suite for all pyFAI modules.
"""

__authors__ = ["Jérôme Kieffer"]
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__data__ = "2011-07-06"

import unittest
import os
import logging
import sys

force_build = False

for opts in sys.argv[:]:
    if opts in ["-d", "--debug"]:
        logging.basicConfig(level=logging.DEBUG)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-i", "--info"]:
        logging.basicConfig(level=logging.INFO)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-f", "--force"]:
        force_build = True
        sys.argv.pop(sys.argv.index(opts))

try:
    logging.debug("tests loaded from file: %s" % __file__)
except:
    __file__ = os.getcwd()

from utilstest import UtilsTest

if force_build:
    UtilsTest.forceBuild()

from testGeometryRefinement   import test_suite_all_GeometryRefinement
from testAzimuthalIntegrator  import test_suite_all_AzimuthalIntegration
from testHistogram            import test_suite_all_Histogram
from testPeakPicking          import test_suite_all_PeakPicking

def test_suite_all():
    testSuite = unittest.TestSuite()
    testSuite.addTest(test_suite_all_Histogram())
    testSuite.addTest(test_suite_all_GeometryRefinement())
    testSuite.addTest(test_suite_all_AzimuthalIntegration())
    testSuite.addTest(test_suite_all_PeakPicking())
    return testSuite

if __name__ == '__main__':

    mysuite = test_suite_all()
    runner = unittest.TextTestRunner()
    runner.run(mysuite)

pyfai-0.3.5/test/example.sp0000644001611600065110000001600511633462462014770 0ustar  kieffersoftSPATIAL DISTORTION SPLINE INTERPOLATION COEFFICIENTS

  VALID REGION
 0.0000000E+00 0.0000000E+00 0.2048000E+04 0.2048000E+04

  GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE
 0.2500000E+04 0.4722438E+02 0.4683152E+02

  X-DISTORTION
    14    15
 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2246664E+03
 0.4432536E+03 0.9552079E+03 0.1259764E+04 0.1544394E+04 0.1804408E+04
 0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2236768E+03
 0.4762803E+03 0.7684895E+03 0.1026443E+04 0.1292742E+04 0.1538168E+04
 0.1795113E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
 0.1535083E+02 0.1076493E+02 0.6949357E+01 0.1744561E+01-0.2366039E+01
-0.7318740E+01-0.1048896E+02-0.1414034E+02-0.1492735E+02-0.1603363E+02
-0.1537288E+02 0.1055121E+02 0.8498821E+01 0.5076883E+01 0.1075899E+01
-0.3848288E+01-0.8233279E+01-0.1119111E+02-0.1330700E+02-0.1600157E+02
-0.1579050E+02-0.1504840E+02 0.5135085E+01 0.4818080E+01 0.1713162E+01
-0.2424825E+01-0.6476648E+01-0.1176909E+02-0.1401328E+02-0.1575502E+02
-0.1625523E+02-0.1656010E+02-0.1729388E+02 0.2765728E+00-0.2441251E+01
-0.5373812E+01-0.8672507E+01-0.1392906E+02-0.1661235E+02-0.1907617E+02
-0.1897881E+02-0.1905490E+02-0.1739466E+02-0.1637078E+02-0.8740438E+01
-0.9962314E+01-0.9372566E+01-0.1320323E+02-0.1385027E+02-0.1693191E+02
-0.1686093E+02-0.1782914E+02-0.1712085E+02-0.1684618E+02-0.1654652E+02
-0.1347715E+02-0.1351849E+02-0.1467949E+02-0.1265138E+02-0.1200397E+02
-0.1045458E+02-0.1037438E+02-0.1155401E+02-0.1169861E+02-0.1286409E+02
-0.1347511E+02-0.1678791E+02-0.1687479E+02-0.1450373E+02-0.1285583E+02
-0.9863098E+01-0.6797175E+01-0.5570945E+01-0.4636785E+01-0.7563279E+01
-0.7846806E+01-0.9231987E+01-0.1614220E+02-0.1746137E+02-0.1666732E+02
-0.1244886E+02-0.8453421E+01-0.3659370E+01-0.1906948E+01-0.5241284E+00
-0.2072738E+01-0.3316919E+01-0.4907596E+01-0.1936429E+02-0.1846539E+02
-0.1564166E+02-0.1239654E+02-0.7820510E+01-0.3014074E+01 0.1134945E+01
 0.3394253E+01 0.2581735E+01-0.2083005E+00 0.5007012E+00-0.2047620E+02
-0.1978745E+02-0.1568741E+02-0.1417389E+02-0.5996676E+01-0.5171342E+01
 0.2520380E+01 0.1477036E+01 0.2805888E+01 0.8579645E+00-0.1563653E+00

  Y-DISTORTION
    23    20
 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.1496108E+03
 0.2721863E+03 0.4178987E+03 0.5381306E+03 0.6858331E+03 0.8162679E+03
 0.9413753E+03 0.1036221E+04 0.1163577E+04 0.1290432E+04 0.1418143E+04
 0.1548779E+04 0.1692615E+04 0.1799250E+04 0.1910604E+04 0.2048000E+04
 0.2048000E+04 0.2048000E+04 0.2048000E+04
 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.1964187E+03
 0.4012936E+03 0.6049906E+03 0.8115546E+03 0.9986447E+03 0.1047219E+04
 0.1142422E+04 0.1284335E+04 0.1455113E+04 0.1604464E+04 0.1740667E+04
 0.1882658E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
-0.2716451E+00-0.3955641E+01-0.7666947E+01-0.1686779E+02-0.1467337E+02
-0.2432359E+02-0.2249255E+02-0.2259957E+02-0.2271049E+02-0.1228782E+02
-0.1383092E+02-0.1087492E+02-0.1042861E+01-0.1363810E+01 0.5757740E+00
-0.1263283E+01-0.1949329E+01-0.3543243E+01-0.7619351E+01-0.1650790E+02
-0.2028738E+02-0.2089124E+02-0.2119374E+02-0.2030268E+02-0.1796068E+02
-0.1951789E+02-0.1411706E+02-0.9309854E+01-0.8405408E+01-0.1035324E+01
 0.2090590E+01-0.1525929E+01 0.9764974E+00-0.3405032E+01-0.9164116E+01
-0.1246337E+02-0.1997486E+02-0.2258389E+02-0.2115727E+02-0.2167421E+02
-0.2172004E+02-0.1778706E+02-0.1546574E+02-0.1155363E+02-0.6310937E+01
-0.2668082E+01-0.1507349E+01 0.2981390E+01 0.1817601E+01-0.3744610E+00
-0.6823599E+01-0.1540060E+02-0.1921754E+02-0.2292349E+02-0.2253362E+02
-0.2230992E+02-0.1898765E+02-0.2042705E+02-0.1523873E+02-0.1237613E+02
-0.1020463E+02-0.3647907E+01-0.3504143E+01 0.5384005E+01 0.3171129E+01
-0.1556188E+01-0.7485898E+01-0.1532609E+02-0.2023733E+02-0.2436352E+02
-0.2342232E+02-0.2248796E+02-0.2246512E+02-0.1996547E+02-0.1622370E+02
-0.1330054E+02-0.8676906E+01-0.6155024E+01-0.9598348E+00-0.4334534E+01
 0.1656793E+01-0.2400740E+01-0.6461067E+01-0.1611795E+02-0.2198001E+02
-0.2433141E+02-0.2350370E+02-0.2370953E+02-0.2165659E+02-0.1821856E+02
-0.1713248E+02-0.1280059E+02-0.1034634E+02-0.5550316E+01-0.4686250E+01
-0.2060861E+00-0.8928451E+00 0.2689514E+00-0.1026333E+02-0.1651597E+02
-0.2218092E+02-0.2496817E+02-0.2594951E+02-0.2268470E+02-0.2329237E+02
-0.2019594E+02-0.1610755E+02-0.1316627E+02-0.8797893E+01-0.7035689E+01
-0.3115985E+01-0.2687772E+01 0.2134094E+01-0.3804123E+01-0.7763778E+01
-0.1868864E+02-0.2388659E+02-0.2658305E+02-0.2431343E+02-0.2400622E+02
-0.2223056E+02-0.1836829E+02-0.1753368E+02-0.1314925E+02-0.9406507E+01
-0.5641295E+01-0.2928677E+01-0.6400106E+01 0.9705959E-01-0.2381162E+01
-0.1194868E+02-0.1820900E+02-0.2502245E+02-0.2695257E+02-0.2657343E+02
-0.2440788E+02-0.2233183E+02-0.2068457E+02-0.1532943E+02-0.1290945E+02
-0.9051538E+01-0.6718315E+01-0.3269133E+01-0.2798177E+01 0.4242986E+00
-0.4450462E+01-0.1019799E+02-0.2012140E+02-0.2496608E+02-0.2790155E+02
-0.2528891E+02-0.2537887E+02-0.2312382E+02-0.1892443E+02-0.1788561E+02
-0.1127047E+02-0.9607083E+01-0.5037954E+01-0.1904939E+01-0.5691902E+01
-0.1724934E+01-0.3837998E+01-0.1371775E+02-0.1942342E+02-0.2586945E+02
-0.2770358E+02-0.2733786E+02-0.2477837E+02-0.2261342E+02-0.2109080E+02
-0.1584147E+02-0.1216737E+02-0.9277504E+01-0.4975915E+01-0.6487498E+01
 0.9042882E+00-0.3891124E+01-0.6618149E+01-0.1036867E+02-0.2094296E+02
-0.2661712E+02-0.2821557E+02-0.2660996E+02-0.2488844E+02-0.2318477E+02
-0.2099893E+02-0.1494376E+02-0.1341716E+02-0.8414506E+01-0.5516052E+01
-0.3585117E+00-0.2587947E+01-0.3393908E+01-0.5587323E+01-0.1464974E+02
-0.2056468E+02-0.2678521E+02-0.2780731E+02-0.2705853E+02-0.2483073E+02
-0.2270437E+02-0.1990776E+02-0.1713709E+02-0.1143918E+02-0.9034024E+01
-0.5959493E+01-0.3626589E+01-0.3565216E+01-0.5774873E+01-0.6693549E+01
-0.1387624E+02-0.2153587E+02-0.2557198E+02-0.2794456E+02-0.2612663E+02
-0.2537648E+02-0.2437642E+02-0.1923620E+02-0.1648068E+02-0.1166780E+02
-0.7550184E+01-0.3979607E+01-0.3600461E+01 0.3170965E+01-0.6253194E+01
-0.9451828E+01-0.1494513E+02-0.2148710E+02-0.2740032E+02-0.2864543E+02
-0.2697890E+02-0.2450190E+02-0.2303167E+02-0.1843495E+02-0.1770224E+02
-0.1102322E+02-0.1055902E+02-0.3757998E+01-0.1739585E+01-0.1714017E+01
-0.8305224E+01-0.8687256E+01-0.1575142E+02-0.2269292E+02-0.2613925E+02
-0.2781220E+02-0.2557445E+02-0.2572113E+02-0.2371160E+02-0.2121587E+02
-0.1532737E+02-0.1211156E+02-0.6761419E+01-0.3971738E+01-0.2676099E+01
 0.2522594E+01-0.6481310E+01-0.1155840E+02-0.1929344E+02-0.2189279E+02
-0.2705568E+02-0.2839713E+02-0.2540857E+02-0.2424788E+02-0.2253183E+02
-0.1755008E+02-0.1735141E+02-0.1253306E+02-0.7411563E+01-0.1722503E+01
-0.2308332E+00 0.1379505E+01-0.1138825E+02-0.1126619E+02-0.1492843E+02
-0.2559361E+02-0.2603434E+02-0.2641008E+02-0.2577283E+02-0.2495603E+02
-0.2274272E+02-0.1805964E+02-0.1553088E+02-0.9971477E+01-0.7325161E+01
-0.4279523E+01-0.3795973E+00 0.2459302E+01-0.5401502E+01-0.1710831E+02
-0.2114833E+02-0.2084257E+02-0.2983810E+02-0.2965279E+02-0.2490102E+02
-0.2266250E+02-0.2117017E+02-0.2377759E+02-0.9965483E+01-0.1205025E+02
-0.4265452E+01 0.2264633E+01-0.1348721E+01 0.6010548E+00
pyfai-0.3.5/test/testGeometryRefinement.py0000755001611600065110000002105211650322024020040 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
"test suite for Geometric Refinement class"

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "06/07/2011"


import unittest
import os
import numpy
import logging
logger = logging.getLogger(os.path.basename(__file__))
import sys

for opts in sys.argv[1:]:
    if opts in ["-d", "--debug"]:
        logging.basicConfig(level=logging.DEBUG)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-i", "--info"]:
        logging.basicConfig(level=logging.INFO)
        sys.argv.pop(sys.argv.index(opts))

try:
    logger.debug("tests loaded from file: %s" % __file__)
except:
    __file__ = os.getcwd()

from utilstest import UtilsTest
from pyFAI.geometryRefinement import GeometryRefinement

class test_geometryRefinement(unittest.TestCase):
    """ tests geometric refinements with or without spline"""

    def test_noSpline(self):
        """tests geometric refinements without spline"""

        pixelSize = [1.5e-5, 1.5e-5]
        data = [
[1585.9999996029055, 2893.9999991192408, 0.53005649383067788],
[1853.9999932086102, 2873.0000001637909, 0.53005649383067788],
[2163.9999987531855, 2854.9999987738884, 0.53005649383067788],
[2699.9999977914931, 2893.9999985831755, 0.53005649383067788],
[3186.9999966428777, 3028.9999985930604, 0.53005649383067788],
[3595.0000039534661, 3167.0000022967461, 0.53005649383067788],
[3835.0000007197755, 3300.0000002536408, 0.53005649383067788],
[1252.0000026881371, 2984.0000056421914, 0.53005649383067788],
[576.99992486352289, 3220.0000014469815, 0.53005649383067788],
[52.999989546760531, 3531.9999975314959, 0.53005649383067788],
[520.99999862452842, 2424.0000005943775, 0.65327673902147754],
[1108.0000045189499, 2239.9999793751085, 0.65327673902147754],
[2022.0000098770186, 2136.9999921020726, 0.65327673902147754],
[2436.000002384907, 2137.0000034435734, 0.65327673902147754],
[2797.9999973906524, 2169.9999849019205, 0.65327673902147754],
[3516.0000041508365, 2354.0000059814265, 0.65327673902147754],
[3870.9999995625412, 2464.9999964079757, 0.65327673902147754],
[3735.9999952703465, 2417.9999888223151, 0.65327673902147754],
[3374.0001428680412, 2289.9999885080188, 0.65327673902147754],
[1709.99999872134, 2165.0000006693272, 0.65327673902147754],
[2004.0000081015958, 1471.0000012076148, 0.7592182246175333],
[2213.0000015244159, 1464.0000243454842, 0.7592182246175333],
[2115.9999952456633, 1475.0000015176133, 0.7592182246175333],
[2242.0000023736206, 1477.0000046142911, 0.7592182246175333],
[2463.9999967564663, 1464.0000011704756, 0.7592182246175333],
[2986.000011249705, 1540.9999994523619, 0.7592182246175333],
[2760.0000031761901, 1514.0000002442944, 0.7592182246175333],
[3372.0000025298395, 1617.9999995345927, 0.7592182246175333],
[3187.0000005152106, 1564.9999952212884, 0.7592182246175333],
[3952.0000062252166, 1765.0000234029771, 0.7592182246175333],
[200.99999875941003, 1190.0000046393075, 0.85451320177642376],
[463.00000674257342, 1121.9999956648539, 0.85451320177642376],
[1455.0000001416358, 936.99999830341949, 0.85451320177642376],
[1673.9999958962637, 927.99999934328309, 0.85451320177642376],
[2492.0000021823594, 922.00000383122256, 0.85451320177642376],
[2639.9999948599761, 936.00000247819059, 0.85451320177642376],
[3476.9999490636446, 1027.9999838362451, 0.85451320177642376],
[3638.9999965727247, 1088.0000258143732, 0.85451320177642376],
[4002.0000051610787, 1149.9999925115812, 0.85451320177642376],
[2296.9999822277705, 908.00000939182382, 0.85451320177642376],
[266.00000015817864, 576.00000049157074, 0.94195419730133967],
[364.00001493127616, 564.00000136247968, 0.94195419730133967],
[752.99999958240187, 496.9999948653093, 0.94195419730133967],
[845.99999758606646, 479.00000730401808, 0.94195419730133967],
[1152.0000082161678, 421.9999937722655, 0.94195419730133967],
[1215.0000019951258, 431.00019867504369, 0.94195419730133967],
[1728.0000096657914, 368.00000247754218, 0.94195419730133967],
[2095.9999932673395, 365.99999862304219, 0.94195419730133967],
[2194.0000006543587, 356.99999967534075, 0.94195419730133967],
[2598.0000021676074, 386.99999979901884, 0.94195419730133967],
[2959.9998766657627, 410.00000323183838, 0.94195419730133967],
]
        r = GeometryRefinement(data, dist=0.1, poni1=0.00, poni2=0.00, pixel1=pixelSize[0], pixel2=pixelSize[1])
        r.refine2(10000000)

        ref = numpy.array([0.089652, 0.030970, 0.027668, -0.699407 , 0.010067  , 0.000001])
        assert abs(numpy.array(r.param) - ref).max() < 1e-3


    def test_Spline(self):
        """tests geometric refinements with spline"""
        splineFine = os.path.join(os.path.dirname(__file__), "example.sp")
        data = [[795, 288, 0.3490658503988659],
        [890, 260, 0.3490658503988659],
        [948, 249, 0.3490658503988659],
        [710, 325, 0.3490658503988659],
        [601, 392, 0.3490658503988659],
        [1167, 248, 0.3490658503988659],
        [1200, 340, 0.3490658503988659],
        [1319, 285, 0.3490658503988659],
        [1362, 302, 0.3490658503988659],
        [1436, 338, 0.3490658503988659],
        [1526, 397, 0.3490658503988659],
        [1560, 424, 0.3490658503988659],
        [1615, 476, 0.3490658503988659],
        [1662, 529, 0.3490658503988659],
        [1742, 650, 0.3490658503988659],
        [1778, 727, 0.3490658503988659],
        [1824, 891, 0.3490658503988659],
        [1831, 947, 0.3490658503988659],
        [1832, 1063, 0.3490658503988659],
        [1828, 1106, 0.3490658503988659],
        [1828, 1106, 0.3490658503988659],
        [1810, 1202, 0.3490658503988659],
        [1775, 1307, 0.3490658503988659],
        [1724, 1407, 0.3490658503988659],
        [1655, 1502, 0.3490658503988659],
        [1489, 1649, 0.3490658503988659],
        [1397, 1700, 0.3490658503988659],
        [1251, 1752, 0.3490658503988659],
        [1126, 1772, 0.3490658503988659],
        [984, 1770, 0.3490658503988659],
        [907, 1758, 0.3490658503988659],
        [801, 1728, 0.3490658503988659],
        [696, 1681, 0.3490658503988659],
        [634, 1644, 0.3490658503988659],
        [568, 1596, 0.3490658503988659],
        [520, 1553, 0.3490658503988659],
        [453, 1479, 0.3490658503988659],
        [403, 1408, 0.3490658503988659],
        [403, 1408, 0.3490658503988659],
        [363, 1337, 0.3490658503988659],
        [320, 1228, 0.3490658503988659],
        [303, 1161, 0.3490658503988659],
        [287, 1023, 0.3490658503988659],
        [287, 993, 0.3490658503988659],
        [304, 846, 0.3490658503988659],
        [329, 758, 0.3490658503988659],
        [341, 726, 0.3490658503988659],
        [402, 606, 0.3490658503988659],
        [437, 555, 0.3490658503988659],
        [513, 467, 0.3490658503988659]]
        r2 = GeometryRefinement(data, dist=0.1, poni1=0.00, poni2=0.00, splineFile=splineFine)
        r2.rot1_max = 0
        r2.rot1_min = -0
        r2.rot2_max = 0
        r2.rot2_min = -0
        r2.rot3_max = 0.1
        r2.rot3_min = -0.1
        r2.refine2(10000000)
#        r2.rot1_max = 1
#        r2.rot1_min = -1
#        r2.rot2_max = 1
#        r2.rot2_min = -1
#        r2.rot3_max = 1
#        r2.rot3_min = -1
#        r2.refine2(10000000)
        ref2 = numpy.array([0.1, 4.917310e-02, 4.722438e-02, 0 , 0.  , 0.00000])
        assert abs(numpy.array(r2.param) - ref2).max() < 1e-3

def test_suite_all_GeometryRefinement():
    testSuite = unittest.TestSuite()
    testSuite.addTest(test_geometryRefinement("test_noSpline"))
    testSuite.addTest(test_geometryRefinement("test_Spline"))
    return testSuite

if __name__ == '__main__':

    mysuite = test_suite_all_GeometryRefinement()
    runner = unittest.TextTestRunner()
    runner.run(mysuite)

pyfai-0.3.5/test/testPeakPicking.py0000644001611600065110000001147211703641246016430 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
"test suite for peak picking class"

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "21/12/2011"


import unittest
import os
import numpy
import logging, time
import sys
import fabio
force_build = False
for opts in sys.argv[1:]:
    if opts in ["-d", "--debug"]:
        logging.basicConfig(level=logging.DEBUG)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-i", "--info"]:
        logging.basicConfig(level=logging.INFO)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-f", "--force"]:
        force_build = True
        sys.argv.pop(sys.argv.index(opts))
logger = logging.getLogger("testPeakPicking")

try:
    logger.debug("tests loaded from file: %s" % __file__)
except:
    __file__ = os.getcwd()
    logger.debug("tests loaded from file: %s" % __file__)

from utilstest import UtilsTest, Rwp
if force_build:
    UtilsTest.forceBuild()
pyFAI = sys.modules["pyFAI"]
from pyFAI.peakPicker import PeakPicker
from pyFAI.geometryRefinement import GeometryRefinement

if logger.getEffectiveLevel() <= logging.INFO:
    import pylab


class test_peak_picking(unittest.TestCase):
    """basic test"""
    calibFile = "1528/moke.tif"
#    gr = GeometryRefinement()
    ctrlPt = {4:(200, 230),
              5:(200, 212),
              6:(200, 195),
              7:(200, 177),
              8:(200, 159),
              9:(200, 140),
              10:(200, 123),
              11:(200, 105),
              12:(200, 87)}
    maxiter = 100
    def setUp(self):
        """Download files"""
        self.img = UtilsTest.getimage(self.__class__.calibFile)
        self.pp = PeakPicker(self.img)
        dirname = os.path.dirname(os.path.abspath(__file__))
        self.tmpdir = os.path.join(dirname, "tmp")
        if not os.path.isdir(self.tmpdir):
            os.mkdir(self.tmpdir)

    def test_peakPicking(self):
        """first test peak-picking then checks the geometry found is OK"""
        logfile = os.path.join(self.tmpdir, "testpeakPicking.log")

        for i in self.ctrlPt:
            pts = self.pp.massif.find_peaks(self.ctrlPt[i], stdout=open(logfile, "a"))
            logger.info("point %s at %i deg generated %i points", self.ctrlPt[i], i, len(pts))
            if len(pts) > 0:
                self.pp.points.append_2theta_deg(pts, i)
            else:
                logger.error("point %s caused error (%s) ", i, self.ctrlPt[i])

        self.pp.points.save(os.path.join(self.tmpdir, "testpeakPicking.npt"))
        lstPeak = self.pp.points.getList()
        logger.info("After peak-picking, we have %s points generated from %s points ", len(lstPeak), len(self.ctrlPt))
        gr = GeometryRefinement(lstPeak, dist=0.05, pixel1=1e-4, pixel2=1e-4)
        logger.info(gr.__repr__())
        last = sys.maxint
        for i in range(self.maxiter):
            delta2 = gr.refine2()
            logger.info(gr.__repr__())
            if delta2 == last:
                logger.info("refinement finished after %s iteration" % i)
                break
            last = delta2
        self.assertEquals(last < 1e-4, True, "residual error is less than 1e-4")
        self.assertAlmostEquals(gr.dist, 0.1, 2, "distance is OK")
        self.assertAlmostEquals(gr.poni1, 2e-2, 2, "PONI1 is OK")
        self.assertAlmostEquals(gr.poni2, 3e-2, 2, "PONI2 is OK")
        self.assertAlmostEquals(gr.rot1, 0, 2, "rot1 is OK")
        self.assertAlmostEquals(gr.rot2, 0, 2, "rot2 is OK")
        self.assertAlmostEquals(gr.rot3, 0, 2, "rot3 is OK")

#        print self.pp.points

def test_suite_all_PeakPicking():
    testSuite = unittest.TestSuite()
    testSuite.addTest(test_peak_picking("test_peakPicking"))
    return testSuite

if __name__ == '__main__':

    mysuite = test_suite_all_PeakPicking()
    runner = unittest.TextTestRunner()
    runner.run(mysuite)
pyfai-0.3.5/test/testHistogram.py0000755001611600065110000002475511703641246016213 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
"test suite for histogramming implementations"

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "19/10/2011"

import unittest
import time
import os
import numpy
import logging
logger = logging.getLogger(os.path.basename(__file__))
import sys
force_build = False
for  opts in sys.argv[:]:
    if opts in ["-d", "--debug"]:
        logging.basicConfig(level=logging.DEBUG)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-i", "--info"]:
        logging.basicConfig(level=logging.INFO)
        sys.argv.pop(sys.argv.index(opts))
    elif opts in ["-f", "--force"]:
        force_build = True
        sys.argv.pop(sys.argv.index(opts))

try:
    logger.debug("tests loaded from file: %s" % __file__)
except:
    __file__ = os.getcwd()

from utilstest import UtilsTest, Rwp
if force_build:
    UtilsTest.forceBuild()
pyFAI = sys.modules["pyFAI"]
from pyFAI.histogram import histogram, histogram2d

if logger.getEffectiveLevel() == logging.DEBUG:
    import pylab

class test_histogram1d(unittest.TestCase):
    """basic test"""
    shape = (2048, 2048)#(numpy.random.randint(1000, 4000), numpy.random.randint(1000, 4000))
    npt = 1500#numpy.random.randint(1000, 4000)
    size = shape[0] * shape[1]
    epsilon = 1.0e-4
    tth = (numpy.random.random(shape).astype("float64"))
    data = numpy.random.random_integers(1, 65000, size=shape).astype("uint16")
    t0 = time.time()
    unweight_numpy, bin_edges = numpy.histogram(tth, npt)
    t1 = time.time()
    weight_numpy, bin_edges = numpy.histogram(tth, npt, weights=data.astype("float64"))
    t2 = time.time()
    logger.info("Timing for Numpy   raw    histogram: %.3f", t1 - t0)
    logger.info("Timing for Numpy weighted histogram: %.3f", t2 - t1)
    bins_numpy = 0.5 * (bin_edges[1:] + bin_edges[:-1])
    I_numpy = weight_numpy / numpy.maximum(1.0, unweight_numpy)
    t3 = time.time()
    bins_cython, I_cython, weight_cython, unweight_cython = histogram(tth, data, npt, pixelSize_in_Pos=0)
    t4 = time.time()
    logger.info("Timing for Cython  both   histogram: %.3f", t4 - t3)


    def test_count_numpy(self):
        """
        Test that the pixel count and the total intensity is conserved 
        in numpy implementation 
        """
        sump = int(self.unweight_numpy.sum(dtype="int64"))
        intensity_obt = self.I_numpy.sum(dtype="float64") * self.size / self.npt
        intensity_exp = self.data.sum(dtype="float64")
        delta = abs(sump - self.size)
        logger.info("Numpy: Total number of points: %s (%s expected), delta = %s", sump, self.size, delta)
        v = abs(intensity_obt - intensity_exp) / intensity_exp
        logger.info("Numpy: Total Intensity: %s (%s expected), variation = %s", intensity_obt, intensity_exp, v)
        self.assertEquals(delta, 0, msg="check all pixels were counted")
        self.assertTrue(v < self.epsilon, msg="checks delta is lower than %s" % self.epsilon)


    def test_count_cython(self):
        """
        Test that the pixel count and the total intensity is conserved 
        in cython implementation 
        """
        sump = int(self.unweight_cython.sum(dtype="float64"))
        intensity_obt = self.I_cython.sum(dtype="float64") * self.size / self.npt
        intensity_exp = self.data.sum(dtype="float64")
        delta = abs(sump - self.size)
        logger.info("Cython: Total number of points: %s (%s expected), delta = %s", sump, self.size, delta)
        v = abs(intensity_obt - intensity_exp) / intensity_exp
        logger.info("Cython: Total Intensity: %s (%s expected), variation = %s", intensity_obt, intensity_exp, v)
        self.assertEquals(delta, 0, msg="check all pixels were counted")
        self.assertTrue(v < self.epsilon, msg="checks delta is lower than %s" % self.epsilon)


    def test_numpy_vs_cython_1d(self):
        """
        Compare numpy histogram with cython simple implementation
        """
        max_delta = abs(self.bins_numpy - self.bins_cython).max()
        logger.info("Bin-center position for cython/numpy, max delta=%s", max_delta)
        assert max_delta < self.epsilon
        rwp = Rwp((self.bins_cython, self.I_cython), (self.bins_numpy, self.I_numpy))
        logger.info("Rwp Cython/Numpy = %.3f" % rwp)
        assert rwp < 5.0
        if logger.getEffectiveLevel() == logging.DEBUG:
            logger.info("Plotting results")
            fig = pylab.figure()
            fig.suptitle('Numpy vs Cython XRPD R=%.3f' % rwp)
            sp = fig.add_subplot(111)
            sp.plot(self.bins_numpy, self.I_numpy, "-b", label='numpy')
            sp.plot(self.bins_cython, self.I_cython, "-r", label="cython")
            handles, labels = sp.get_legend_handles_labels()
            fig.legend(handles, labels)
            fig.show()
            raw_input("Press enter to quit")
        delta_max = abs(self.unweight_numpy - self.unweight_cython).max()
        logger.info("pixel count difference numyp/cython : max delta=%s", delta_max)
        assert  delta_max < 2
        delta_max = abs(self.I_cython - self.I_numpy).max()
        logger.info("Intensity count difference numyp/cython : max delta=%s", delta_max)
        assert delta_max < self.epsilon


class test_histogram2d(unittest.TestCase):
    """basic test for 2D histogram"""
    shape = (2048, 2048)#(numpy.random.randint(1000, 4000), numpy.random.randint(1000, 4000))
    npt = (400, 360)
    size = shape[0] * shape[1]
    epsilon = 3.0e-4
    tth = (numpy.random.random(shape).astype("float64"))
    chi = (numpy.random.random(shape).astype("float64"))
    data = numpy.random.random_integers(1, 65000, size=shape).astype("uint16")
    t0 = time.time()
    unweight_numpy, tth_edges, chi_edges = numpy.histogram2d(tth.flatten(), chi.flatten(), npt)
    t1 = time.time()
    weight_numpy, tth_edges, chi_edges = numpy.histogram2d(tth.flatten(), chi.flatten(), npt, weights=data.astype("float64").flatten())
    t2 = time.time()
    logger.info("Timing for Numpy  raw     histogram2d: %.3f", t1 - t0)
    logger.info("Timing for Numpy weighted histogram2d: %.3f", t2 - t1)
    tth_numpy = 0.5 * (tth_edges[1:] + tth_edges[:-1])
    chi_numpy = 0.5 * (chi_edges[1:] + chi_edges[:-1])
    I_numpy = weight_numpy / numpy.maximum(1.0, unweight_numpy)
    t3 = time.time()
    I_cython, tth_cython, chi_cython, weight_cython, unweight_cython = histogram2d(tth.flatten(), chi.flatten(), npt, data.flatten(), split=0)
    t4 = time.time()
    logger.info("Timing for Cython  both   histogram2d: %.3f", t4 - t3)

    def test_count_numpy(self):
        """
        Test that the pixel count and the total intensity is conserved 
        in numpy implementation 
        """
        sump = int(self.unweight_numpy.sum(dtype="int64"))
        intensity_obt = self.I_numpy.sum(dtype="float64") * self.size / float(self.npt[0] * self.npt[1])
        intensity_exp = self.data.sum(dtype="float64")
        delta = abs(sump - self.size)
        logger.info("Numpy: Total number of points: %s (%s expected), delta = %s", sump, self.size, delta)
        v = abs(intensity_obt - intensity_exp) / intensity_exp
        logger.info("Numpy: Total Intensity: %s (%s expected), variation = %s", intensity_obt, intensity_exp, v)
        assert  delta == 0
        assert v < self.epsilon


    def test_count_cython(self):
        """
        Test that the pixel count and the total intensity is conserved 
        in cython implementation 
        """
        sump = int(self.unweight_cython.sum(dtype="int64"))
        intensity_obt = self.I_cython.sum(dtype="float64") * self.size / float(self.npt[0] * self.npt[1])
        intensity_exp = self.data.sum(dtype="float64")
        delta = abs(sump - self.size)
        logger.info("Cython: Total number of points: %s (%s expected), delta = %s", sump, self.size, delta)
        v = abs(intensity_obt - intensity_exp) / intensity_exp
        logger.info("Cython: Total Intensity: %s (%s expected), variation = %s", intensity_obt, intensity_exp, v)
        self.assertEquals(delta, 0, msg="check all pixels were counted")
        self.assertTrue(v < self.epsilon, msg="checks delta is lower than %s" % self.epsilon)


    def test_numpy_vs_cython_1d(self):
        """
        Compare numpy histogram with cython simple implementation
        """
        max_delta = abs(self.tth_numpy - self.tth_cython).max()
        logger.info("Bin-center position for cython/numpy tth, max delta=%s", max_delta)
        assert max_delta < self.epsilon
        max_delta = abs(self.chi_numpy - self.chi_cython).max()
        logger.info("Bin-center position for cython/numpy chi, max delta=%s", max_delta)
        assert max_delta < self.epsilon

        delta_max = abs(self.unweight_numpy - self.unweight_cython).max()
        logger.info("pixel count difference numyp/cython : max delta=%s", delta_max)
        assert  delta_max < 2
        delta_max = abs(self.I_cython - self.I_numpy).max()
        logger.info("Intensity count difference numyp/cython : max delta=%s", delta_max)
        assert delta_max < self.epsilon


def test_suite_all_Histogram():
    testSuite = unittest.TestSuite()
    testSuite.addTest(test_histogram1d("test_count_numpy"))
    testSuite.addTest(test_histogram1d("test_count_cython"))
    testSuite.addTest(test_histogram1d("test_numpy_vs_cython_1d"))
    testSuite.addTest(test_histogram2d("test_count_numpy"))
    testSuite.addTest(test_histogram2d("test_count_cython"))
    testSuite.addTest(test_histogram2d("test_numpy_vs_cython_1d"))

    return testSuite

if __name__ == '__main__':

    mysuite = test_suite_all_Histogram()
    runner = unittest.TextTestRunner()
    runner.run(mysuite)
pyfai-0.3.5/pyFAI-src/0000755001611600065110000000000011706351114013535 5ustar  kieffersoftpyfai-0.3.5/pyFAI-src/geometryRefinement.py0000755001611600065110000003132011705103306017756 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/12/2011"
__status__ = "development"

import os, tempfile, subprocess, logging, threading
import numpy
from math                   import pi
from azimuthalIntegrator    import AzimuthalIntegrator
from scipy.optimize         import fmin, leastsq, fmin_slsqp, anneal
from scipy.interpolate      import interp2d

if os.name != "nt":
    WindowsError = RuntimeError

logger = logging.getLogger("pyFAI.geometryRefinement")
#logger.setLevel(logging.DEBUG)
ROCA = "/opt/saxs/roca"

################################################################################
# GeometryRefinement
################################################################################
class GeometryRefinement(AzimuthalIntegrator):
    def __init__(self, data, dist=1, poni1=None, poni2=None, rot1=0, rot2=0, rot3=0, pixel1=1, pixel2=1, splineFile=None):
        self.data = numpy.array(data, dtype="float64")
        if (poni1 is None) and (poni2 is None):
            AzimuthalIntegrator.__init__(self, dist, 0, 0, rot1, rot2, rot3, pixel1, pixel2, splineFile)
        else:
            AzimuthalIntegrator.__init__(self, dist, poni1, poni2 , rot1, rot2, rot3, pixel1, pixel2, splineFile)
        if (poni1 is None) and (poni2 is None):
            tth = self.data[:, 2]
            asrt = tth.argsort()
            tth = tth[asrt]
            srtdata = self.data[asrt]
            smallRing = srtdata[tth < (tth.min() + 1e-6)]
            center = smallRing.sum(axis=0) / len(smallRing)
            self.poni1 = center[0] * self.pixel1
            self.poni2 = center[1] * self.pixel2
        self._dist_min = 0
        self._dist_max = 10
        self._poni1_min = -10000 * pixel1
        self._poni1_max = 15000 * pixel1
        self._poni2_min = -10000 * pixel2
        self._poni2_max = 15000 * pixel2
        self._rot1_min = -pi
        self._rot1_max = pi
        self._rot2_min = -pi
        self._rot2_max = pi
        self._rot3_min = -pi
        self._rot3_max = pi

    def residu1(self, param, d1, d2, tthRef):
        return self.tth(d1, d2, param) - tthRef

    def residu2(self, param, d1, d2, tthRef):
        return (self.residu1(param, d1, d2, tthRef) ** 2).sum()

    def refine1(self):
        self.param = numpy.array([self._dist, self._poni1, self._poni2, self._rot1, self._rot2, self._rot3], dtype="float64")
        newParam, rc = leastsq(self.residu1, self.param, args=(self.data[:, 0], self.data[:, 1], self.data[:, 2]))
        oldDeltaSq = self.chi2(tuple(self.param))
        newDeltaSq = self.chi2(tuple(newParam))
        logger.info("Least square retcode=%s %s --> %s", rc, oldDeltaSq, newDeltaSq)
        if newDeltaSq < oldDeltaSq:
            i = abs(self.param - newParam).argmax()
            d = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3"]
            logger.info("maxdelta on %s: %s --> %s ", d[i], self.param[i], newParam[i])
            self.param = newParam
            self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3 = tuple(newParam)
            return newDeltaSq
        else:
            return oldDeltaSq

    def refine2(self, maxiter=1000000):
        self.param = numpy.array([self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3], dtype="float64")
        if logger.getEffectiveLevel() <= logging.INFO:
            disp = 1
        else:
            disp = 0
        newParam = fmin_slsqp(self.residu2, self.param, iter=maxiter, args=(self.data[:, 0], self.data[:, 1], self.data[:, 2]),
                              bounds=[(self._dist_min, self._dist_max),
                                      (self._poni1_min, self._poni1_max),
                                      (self._poni2_min, self._poni2_max),
                                      (self._rot1_min, self._rot1_max),
                                      (self._rot2_min, self._rot2_max),
                                      (self._rot3_min, self._rot3_max)],
                              acc=1.0e-12, iprint=disp)
        oldDeltaSq = self.chi2()
        newDeltaSq = self.chi2(newParam)
        logger.info("Constrained Least square %s --> %s", oldDeltaSq, newDeltaSq)
        if newDeltaSq < oldDeltaSq:
            i = abs(self.param - newParam).argmax()
            d = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3"]
            logger.info("maxdelta on %s: %s --> %s ", d[i], self.param[i], newParam[i])
            self.param = newParam
            self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3 = tuple(newParam)
            return newDeltaSq
        else:
            return oldDeltaSq

    def simplex(self, maxiter=1000000):
        self.param = numpy.array([self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3], dtype="float64")
        newParam = fmin(self.residu2, self.param, args=(self.data[:, 0], self.data[:, 1], self.data[:, 2]),
                              maxiter=maxiter, xtol=1.0e-12)
        oldDeltaSq = self.chi2(tuple(self.param))
        newDeltaSq = self.chi2(tuple(newParam))
        logger.info("Simplex %s --> %s", oldDeltaSq, newDeltaSq)
        if newDeltaSq < oldDeltaSq:
            i = abs(self.param - newParam).argmax()
            d = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3"]
            logger.info("maxdelta on %s : %s --> %s ", d[i], self.param[i], newParam[i])
            self.param = newParam
            self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3 = tuple(newParam)
            return newDeltaSq
        else:
            return oldDeltaSq


    def anneal(self, maxiter=1000000):
        self.param = [self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3]
        result = anneal(self.residu2, self.param, args=(self.data[:, 0], self.data[:, 1], self.data[:, 2]),
                        lower=[self._dist_min, self._poni1_min, self._poni2_min, self._rot1_min , self._rot2_min, self._rot3_min],
                        upper=[self._dist_max, self._poni1_max, self._poni2_max, self._rot1_max , self._rot2_max, self._rot3_max],
                        maxiter=maxiter)
        newParam = result[0]
        oldDeltaSq = self.chi2()
        newDeltaSq = self.chi2(newParam)
        logger.info("Anneal  %s --> %s", oldDeltaSq, newDeltaSq)
        if newDeltaSq < oldDeltaSq:
            i = abs(self.param - newParam).argmax()
            d = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3"]
            logger.info("maxdelta on %s : %s --> %s ", d[i], self.param[i], newParam[i])
            self.param = newParam
            self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3 = tuple(newParam)
            return newDeltaSq
        else:
            return oldDeltaSq

    def chi2(self, param=None):
        if param == None:
            param = self.param
        return  self.residu2(param, self.data[:, 0], self.data[:, 1], self.data[:, 2])

    def roca(self):
        """
        run roca to optimise the parameter set
        """
        tmpf = tempfile.NamedTemporaryFile()
        for line in self.data:
            tmpf.write("%s %s %s %s" % (line[2], line[0], line[1], os.linesep))
        tmpf.flush()
        roca = subprocess.Popen([ROCA, "debug=8", "maxdev=1", "input=" + tmpf.name,
                                 str(self.pixel1), str(self.pixel2),
                                 str(self.poni1 / self.pixel1), str(self.poni2 / self.pixel2),
                                 str(self.dist), str(self.rot1), str(self.rot2), str(self.rot3)],
                                 stdout=subprocess.PIPE)
        newParam = [self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3]
        for line in roca.stdout:
            word = line.split()
            if len(word) == 3:
                if word[0] == "cen1":
                    newParam[1] = float(word[1]) * self.pixel1
                if word[0] == "cen2":
                    newParam[2] = float(word[1]) * self.pixel2
                if word[0] == "dis":
                    newParam[0] = float(word[1])
                if word[0] == "rot1":
                    newParam[3] = float(word[1])
                if word[0] == "rot2":
                    newParam[4] = float(word[1])
                if word[0] == "rot3":
                    newParam[5] = float(word[1])
        print "Roca", self.chi2(), "--> ", self.chi2(newParam)
        if self.chi2(tuple(newParam)) < self.chi2(tuple(self.param)):
            self.param = newParam
            self.dist, self.poni1, self.poni2, self.rot1, self.rot2, self.rot3 = tuple(newParam)

        tmpf.close()

    def set_dist_max(self, value):
        if isinstance(value, float):
            self._dist_max = value
        else:
            self._dist_max = float(value)
    def get_dist_max(self):
        return self._dist_max
    dist_max = property(get_dist_max, set_dist_max)
    def set_dist_min(self, value):
        if isinstance(value, float):
            self._dist_min = value
        else:
            self._dist_min = float(value)
    def get_dist_min(self):
        return self._dist_min
    dist_min = property(get_dist_min, set_dist_min)


    def set_poni1_min(self, value):
        if isinstance(value, float):
            self._poni1_min = value
        else:
            self._poni1_min = float(value)
    def get_poni1_min(self):
        return self._poni1_min
    poni1_min = property(get_poni1_min, set_poni1_min)
    def set_poni1_max(self, value):
        if isinstance(value, float):
            self._poni1_max = value
        else:
            self._poni1_max = float(value)
    def get_poni1_max(self):
        return self._poni1_max
    poni1_max = property(get_poni1_max, set_poni1_max)

    def set_poni2_min(self, value):
        if isinstance(value, float):
            self._poni2_min = value
        else:
            self._poni2_min = float(value)
    def get_poni2_min(self):
        return self._poni2_min
    poni2_min = property(get_poni2_min, set_poni2_min)
    def set_poni2_max(self, value):
        if isinstance(value, float):
            self._poni2_max = value
        else:
            self._poni2_max = float(value)
    def get_poni2_max(self):
        return self._poni2_max
    poni2_max = property(get_poni2_max, set_poni2_max)

    def set_rot1_min(self, value):
        if isinstance(value, float):
            self._rot1_min = value
        else:
            self._rot1_min = float(value)
    def get_rot1_min(self):
        return self._rot1_min
    rot1_min = property(get_rot1_min, set_rot1_min)
    def set_rot1_max(self, value):
        if isinstance(value, float):
            self._rot1_max = value
        else:
            self._rot1_max = float(value)
    def get_rot1_max(self):
        return self._rot1_max
    rot1_max = property(get_rot1_max, set_rot1_max)

    def set_rot2_min(self, value):
        if isinstance(value, float):
            self._rot2_min = value
        else:
            self._rot2_min = float(value)
    def get_rot2_min(self):
        return self._rot2_min
    rot2_min = property(get_rot2_min, set_rot2_min)
    def set_rot2_max(self, value):
        if isinstance(value, float):
            self._rot2_max = value
        else:
            self._rot2_max = float(value)
    def get_rot2_max(self):
        return self._rot2_max
    rot2_max = property(get_rot2_max, set_rot2_max)

    def set_rot3_min(self, value):
        if isinstance(value, float):
            self._rot3_min = value
        else:
            self._rot3_min = float(value)
    def get_rot3_min(self):
        return self._rot3_min
    rot3_min = property(get_rot3_min, set_rot3_min)
    def set_rot3_max(self, value):
        if isinstance(value, float):
            self._rot3_max = value
        else:
            self._rot3_max = float(value)
    def get_rot3_max(self):
        return self._rot3_max
    rot3_max = property(get_rot3_max, set_rot3_max)




pyfai-0.3.5/pyFAI-src/spline.py0000755001611600065110000006200511705103306015404 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: UTF8 -*-
###########################################################################
# Written 2009-12-22 by Jérôme Kieffer 
# Copyright (C) 2009 European Synchrotron Radiation Facility
#                       Grenoble, France
#
#    Principal authors: Jérôme Kieffer  (jerome.kieffer@esrf.fr)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
########################################################################################

""" This is piece of software aims to manipulate spline files for 
geometric corrections of the 2D detectors  using cubic-spline"""

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@esrf.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"

import os, time, sys
import numpy, scipy, Image, fabio
import scipy.optimize
import scipy.interpolate
import scipy.interpolate.fitpack



class Spline:
    """This class is a python representation of the spline file 
    Those file represent cubic splines for 2D detector distortions and makes heavy use of 
    fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
    FITPACK is a collection of FORTRAN programs for curve and surface fitting with splines and tensor product splines.
    See
    http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html
    or
    http://www.netlib.org/dierckx/index.html
    """


    def __init__(self, filename=None):
        """this is the constructor of the Spline class, for"""
        self.splineOrder = 3  #This is the default, so cubic splines
        self.lenStrFloat = 14 # by default one float is 14 char in ascii
        self.xmin = None
        self.ymin = None
        self.xmax = None
        self.ymax = None
        self.xDispArray = None
        self.yDispArray = None
        self.xSplineKnotsX = []
        self.xSplineKnotsY = []
        self.xSplineCoeff = []
        self.ySplineKnotsX = []
        self.ySplineKnotsY = []
        self.ySplineCoeff = []
        self.pixelSize = None
        self.grid = None
        self.filename = None
        if filename is not None:
            self.read(filename)



    def __repr__(self):
        txt = "Array size: x= %s - %s\ty= %s - %s" % (self.xmin, self.xmax, self.ymin, self.ymax)
        txt += "\nPixel size = %s microns, Grid spacing = %s" % (self.pixelSize, self.grid)
        txt += "\nX-Displacement spline %i X_knots, %i Y_knots and %i coef: should be (X_knot-1-X_order)*(Y_knot-1-Y_order)" \
                    % (len(self.xSplineKnotsX), len(self.xSplineKnotsY), len(self.xSplineCoeff))
        txt += "\nY-Displacement spline %i X_knots, %i Y_knots and %i coef: should be (X_knot-1-X_order)*(Y_knot-1-Y_order)" \
                    % (len(self.ySplineKnotsX), len(self.ySplineKnotsY), len(self.ySplineCoeff))
        return txt


    def zeros(self, xmin=0.0, ymin=0.0, xmax=2048.0, ymax=2048.0, pixSize=None):
        """defines a spline file with no ( zero ) displacement.
        @type xmin: float
        @type xmax: float
        @type ymax: float
        @type ymin: float
        @param xmin: minimum coordinate in x, usually zero
        @param xmax: maximum coordinate in x (+1) usually 2048
        @param ymin: minimum coordinate in y, usually zero
        @param ymax: maximum coordinate y (+1) usually 2048
        """
        self.xmin = xmin
        self.ymin = ymin
        self.xmax = xmax
        self.ymax = ymax
        self.xDispArray = numpy.zeros((int(xmax - xmin + 1), int(ymax - ymin + 1)))
        self.yDispArray = numpy.zeros((int(xmax - xmin + 1), int(ymax - ymin + 1)))
        if pixSize:
            self.pixelSize = pixSize


    def zeros_like(self, other):
        """defines a spline file with no ( zero ) displacement with the same shape as the other one given.
        @param other: another Spline
        @type other: Spline
        """
        self.zeros(self, other.xmin, other.ymin, other.xmax, other.ymax)


    def read(self, filename):
        """read an ascii spline file from file
        @param filename: name of the file containing the cubic spline distortion file
        @type filename: string
        """
        if not os.path.isfile(filename):
            raise IOError("File does not exist %s" % filename)
        self.filename = filename
        stringSpline = [ i.rstrip() for i in open (filename).readlines() ]
        indexLine = 0
        for oneLine in stringSpline:
            stripedLine = oneLine.strip().upper()
            if stripedLine == "VALID REGION":
                data = stringSpline[ indexLine + 1 ]
                self.xmin = float(data[self.lenStrFloat * 0:self.lenStrFloat * 1])
                self.ymin = float(data[self.lenStrFloat * 1:self.lenStrFloat * 2])
                self.xmax = float(data[self.lenStrFloat * 2:self.lenStrFloat * 3])
                self.ymax = float(data[self.lenStrFloat * 3:self.lenStrFloat * 4])
            elif stripedLine == "GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE":
                data = stringSpline[ indexLine + 1 ]
                self.grid = float(data[:self.lenStrFloat])
                self.pixelSize = (float(data[self.lenStrFloat:self.lenStrFloat * 2]), float(data[self.lenStrFloat * 2:self.lenStrFloat * 3]))
            elif stripedLine == "X-DISTORTION":
                data = stringSpline[ indexLine + 1 ]
                [splineKnotsXLen, splineKnotsYLen] = [ int(i)  for i in data.split() ]
                databloc = []
                for line in  stringSpline[ indexLine + 2 : ]:
                    if len(line) > 0 :
                        for i in range(len(line) / self.lenStrFloat):
                            databloc.append(float(line[i * self.lenStrFloat: (i + 1) * self.lenStrFloat ]))
                    else:
                        break
                self.xSplineKnotsX = databloc[ : splineKnotsXLen ]
                self.xSplineKnotsY = databloc[splineKnotsXLen: splineKnotsXLen + splineKnotsYLen]
                self.xSplineCoeff = databloc[ splineKnotsXLen + splineKnotsYLen: ]
            elif stripedLine == "Y-DISTORTION":
                data = stringSpline[ indexLine + 1 ]
                [splineKnotsXLen, splineKnotsYLen] = [ int(i)  for i in data.split() ]
                databloc = []
                for line in  stringSpline[ indexLine + 2 : ]:
                    if len(line) > 0 :
                        for i in range(len(line) / self.lenStrFloat):
                            databloc.append(float(line[i * self.lenStrFloat: (i + 1) * self.lenStrFloat ]))
                    else:
                        break
                self.ySplineKnotsX = databloc[ : splineKnotsXLen ]
                self.ySplineKnotsY = databloc[splineKnotsXLen: splineKnotsXLen + splineKnotsYLen]
                self.ySplineCoeff = databloc[ splineKnotsXLen + splineKnotsYLen: ]
# Keep this at the end
            indexLine += 1


    def comparison(self, ref, verbose=False):
        """Compares the current spline distortion with a reference
        @param ref: another spline file
        @return: True or False depending if the splines are the same or not """
        self.spline2array()
        ref.spline2array()
        deltax = (self.xDispArray - ref.xDispArray)
        deltay = (self.yDispArray - ref.yDispArray)
        histX = numpy.histogram(deltax.reshape(deltax.size), bins=100)
        histY = numpy.histogram(deltay.reshape(deltay.size), bins=100)
        histXdr = (histX[1][1:] + histX[1][:-1]) / 2.0
        histYdr = (histY[1][1:] + histY[1][:-1]) / 2.0
        histXmax = histXdr [histX[0].argmax()]
        histYmax = histYdr [histY[0].argmax()]
        maxErrX = abs(deltax).max()
        maxErrY = abs(deltay).max()
        curvX = scipy.interpolate.interp1d(histXdr, histX[0] - histX[0].max() / 2.0)
        curvY = scipy.interpolate.interp1d(histYdr, histY[0] - histY[0].max() / 2.0)
        fFWHM_X = scipy.optimize.bisect(curvX , histXmax, histXdr[-1]) - scipy.optimize.bisect(curvX , histXdr[0], histXmax)
        fFWHM_Y = scipy.optimize.bisect(curvY , histYmax, histYdr[-1]) - scipy.optimize.bisect(curvY , histYdr[0], histYmax)
        print ("Analysis of the difference between two splines")
        print ("Maximum error in X= %.3f pixels,\t in Y= %.3f pixels." % (maxErrX, maxErrY))
        print ("Maximum of histogram in X= %.3f pixels,\t in Y= %.3f pixels." % (histXmax, histYmax))
        print ("Mean of histogram in X= %.3f pixels,\t in Y= %.3f pixels." % (deltax.mean(), deltay.mean()))
        print ("FWHM in X= %.3f pixels,\t in Y= %.3f pixels." % (fFWHM_X, fFWHM_Y))

        if verbose:
            import pylab
            pylab.plot(histXdr , histX[0], label="error in X")
            pylab.plot(histYdr, histY[0], label="error in Y")
            pylab.legend()
            pylab.show()
        return (fFWHM_X < 0.05) and (fFWHM_Y < 0.05) and (maxErrX < 0.5) and (maxErrY < 0.5) \
                and (deltax.mean() < 0.01) and(deltay.mean() < 0.01) and (histXmax < 0.01) and (histYmax < 0.01)


    def spline2array(self, timing=False):
        """calculates the displacement matrix using fitpack
         bisplev(x, y, tck, dx = 0, dy = 0)

         Evaluate a bivariate B-spline and its derivatives.
         Return a rank-2 array of spline function values (or spline derivative
         values) at points given by the cross-product of the rank-1 arrays x and y.
         In special cases, return an array or just a float if either x or y or
         both are floats.
        """
        if  (self.xDispArray == None) :
            x_1d_array = numpy.arange(self.xmin, self.xmax + 1)
            y_1d_array = numpy.arange(self.ymin, self.ymax + 1)
            startTime = time.time()
            self.xDispArray = scipy.interpolate.fitpack.bisplev(x_1d_array, y_1d_array, \
                                               [self.xSplineKnotsX, self.xSplineKnotsY, self.xSplineCoeff, self.splineOrder, self.splineOrder ], \
                                               dx=0, dy=0).transpose()
            intermediateTime = time.time()
            self.yDispArray = scipy.interpolate.fitpack.bisplev(x_1d_array, y_1d_array, \
                                               [self.ySplineKnotsX, self.ySplineKnotsY, self.ySplineCoeff, self.splineOrder, self.splineOrder ], \
                                               dx=0, dy=0).transpose()
            if timing:
                print "Timing for: X-Displacement spline evaluation: %.3f sec, Y-Displacement Spline evaluation:  %.3f sec." % \
                        ((intermediateTime - startTime), (time.time() - intermediateTime))

    def splineFuncX(self, x, y):
        """ calculates the displacement matrix using fitpack for the X direction 
        @param x: numpy array repesenting the points in the x direction
        @param y: numpy array repesenting the points in the y direction
        @return: displacement matrix for the X direction
        @rtype: numpy arrays
        """
        if x.ndim == 2:
            if abs(x[1:, :] - x[:-1, :] - numpy.zeros((x.shape[0] - 1, x.shape[1]))).max() < 1e-6:
                x = x[0]
                y = y[:, 0]
            elif abs(x[:, 1:] - x[:, :-1] - numpy.zeros((x.shape[0], x.shape[1] - 1))).max() < 1e-6:
                x = x[:, 0]
                y = y[0]
        xDispArray = scipy.interpolate.fitpack.bisplev(x, y, \
                                               [self.xSplineKnotsX, self.xSplineKnotsY, self.xSplineCoeff, self.splineOrder, self.splineOrder ], \
                                               dx=0, dy=0).transpose()
        return xDispArray

    def splineFuncY(self, x, y):
        """ calculates the displacement matrix using fitpack for the Y direction 
        @param x: numpy array repesenting the points in the x direction
        @param y: numpy array repesenting the points in the y direction
        @return: displacement matrix for the Y direction
        @rtype: numpy array
        """
        if x.ndim == 2:
            if abs(x[1:, :] - x[:-1, :] - numpy.zeros((x.shape[0] - 1, x.shape[1]))).max() < 1e-6:
                x = x[0]
                y = y[:, 0]
            elif abs(x[:, 1:] - x[:, :-1] - numpy.zeros((x.shape[0], x.shape[1] - 1))).max() < 1e-6:
                x = x[:, 0]
                y = y[0]

        yDispArray = scipy.interpolate.fitpack.bisplev(x, y, \
                                               [self.ySplineKnotsX, self.ySplineKnotsY, self.ySplineCoeff, self.splineOrder, self.splineOrder ], \
                                               dx=0, dy=0).transpose()
        return yDispArray


    def array2spline(self, smoothing=1000, timing=False):
        """calculates the spline coefficents from the displacements matrix using fitpack
       """
        self.xmin = 0.0
        self.ymin = 0.0
        self.xmax = float(self.xDispArray.shape[0] - 1)
        self.ymax = float(self.yDispArray.shape[1] - 1)
        if timing:
            startTime = time.time()
        xRectBivariateSpline = scipy.interpolate.fitpack2.RectBivariateSpline(numpy.arange(self.xmax + 1.0), numpy.arange(self.ymax + 1), self.xDispArray.transpose(), s=smoothing)
        if timing:
            intermediateTime = time.time()
        yRectBivariateSpline = scipy.interpolate.fitpack2.RectBivariateSpline(numpy.arange(self.xmax + 1.0), numpy.arange(self.ymax + 1), self.yDispArray.transpose(), s=smoothing)
        if timing:
            print "X-Displ evaluation= %.3f sec, Y-Displ evaluation=  %.3f sec." % (intermediateTime - startTime, time.time() - intermediateTime)
        print len(xRectBivariateSpline.get_coeffs()), "x-coefs", xRectBivariateSpline.get_coeffs()
        print len(yRectBivariateSpline.get_coeffs()), "y-coefs", yRectBivariateSpline.get_coeffs()
        print len(xRectBivariateSpline.get_knots()[0]), len(xRectBivariateSpline.get_knots()[1]), "x-knots", xRectBivariateSpline.get_knots()
        print len(yRectBivariateSpline.get_knots()[0]), len(yRectBivariateSpline.get_knots()[1]), "y-knots", yRectBivariateSpline.get_knots()
        print "Residual x,y", xRectBivariateSpline.get_residual(), yRectBivariateSpline.get_residual()
        self.xSplineKnotsX = xRectBivariateSpline.get_knots()[0]
        self.xSplineKnotsY = xRectBivariateSpline.get_knots()[1]
        self.xSplineCoeff = xRectBivariateSpline.get_coeffs()
        self.ySplineKnotsX = yRectBivariateSpline.get_knots()[0]
        self.ySplineKnotsY = yRectBivariateSpline.get_knots()[1]
        self.ySplineCoeff = yRectBivariateSpline.get_coeffs()


    def writeEDF(self, basename):
        """save the distortion matrices into a couple of files called basename-x.edf and  basename-y.edf
        
        """
        try:
            from fabio.edfimage import edfimage
            #from EdfFile import EdfFile as EDF
        except ImportError:
            print "You will need the Fabio library available from the Fable sourceforge"
            return
        self.spline2array()

        edfDispX = edfimage(data=self.xDispArray.astype("float32"), header={})
        edfDispY = edfimage(data=self.yDispArray.astype("float32"), header={})
        edfDispX.write(basename + "-x.edf", force_type="float32")
        edfDispY.write(basename + "-y.edf", force_type="float32")


    def write(self, filename):
        """save the cubic spline in an ascii file usable with Fit2D or SPD
        @param filename: name of the file containing the cubic spline distortion file
        @type filename: string
        """

        txt = "SPATIAL DISTORTION SPLINE INTERPOLATION COEFFICIENTS\n\n  VALID REGION\n%14.7E%14.7E%14.7E%14.7E\n\n" % (self.xmin, self.ymin, self.xmax, self.ymax)
        txt += "  GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE\n%14.7E%14.7E%14.7E\n\n" % (self.grid, self.pixelSize[0], self.pixelSize[1])
        txt += "  X-DISTORTION\n%6i%6i" % (len(self.xSplineKnotsX), len(self.xSplineKnotsY))
        for i in range(len(self.xSplineKnotsX)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.xSplineKnotsX[i]
        for i in range(len(self.xSplineKnotsY)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.xSplineKnotsY[i]
        for i in range(len(self.xSplineCoeff)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.xSplineCoeff[i]
        txt += "\n\n  Y-DISTORTION\n%6i%6i" % (len(self.ySplineKnotsX), len(self.ySplineKnotsY))
        for i in range(len(self.ySplineKnotsX)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.ySplineKnotsX[i]
        for i in range(len(self.ySplineKnotsY)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.ySplineKnotsY[i]
        for i in range(len(self.ySplineCoeff)):
            if i % 5 == 0:
                txt += "\n"
            txt += "%14.7E" % self.ySplineCoeff[i]
        txt += "\n"
        open(filename, "w").write(txt)


    def tilt(self, center=(0.0, 0.0), tiltAngle=0.0, tiltPlanRot=0.0, distanceSampleDetector=1.0, timing=False):
        """The tilt method apply a virtual tilt on the detector, the point of tilt is given by the center
        
        @param center: position of the point of tilt, this point will not be moved.
        @type center: 2tuple of floats
        @param tiltAngle: the value of the tilt in degrees
        @type tiltAngle: float in the range [-90:+90] degrees
        @param tiltPlanRot: the rotation of the tilt plan with the Ox axis (0 deg for y axis invariant, 90 deg for x axis invariant)  
        @type tiltPlanRot: Float in the range [-180:180]
        @type distanceSampleDetector: float
        @param distanceSampleDetector: the distance from sample to detector in meter (along the beam, so distance from sample to center)
        @return: tilted Spline instance
        @rtype: Spline
        """
        if self.xDispArray is None:
            if self.filename is None:
                self.zeros()
            else:
                self.read()
        print("center=%s, tilt=%s, tiltPlanRot=%s, distanceSampleDetector=%sm, pixelSize=%sµm" % (center, tiltAngle, tiltPlanRot, distanceSampleDetector, self.pixelSize))
        if timing:
            startTime = time.time()
        distance = 1.0e6 * distanceSampleDetector #from meters to microns
        cosb = numpy.cos(numpy.radians(tiltPlanRot))
        sinb = numpy.sin(numpy.radians(tiltPlanRot))
        cosf = numpy.cos(numpy.radians(tiltAngle))
        sinf = numpy.sin(numpy.radians(tiltAngle))

        x = lambda i, j: j - center[0] - 0.5 #x and y are tilted in C/Fortran representation
        y = lambda i, j: i - center[1] - 0.5

        iPos = numpy.fromfunction(x, (int(self.ymax - self.ymin + 1), int(self.xmax - self.xmin + 1)))
        jPos = numpy.fromfunction(y, (int(self.ymax - self.ymin + 1), int(self.xmax - self.xmin + 1)))

        xPos = (iPos + self.xDispArray) * self.pixelSize[0]
        yPos = (jPos + self.yDispArray) * self.pixelSize[1]

        tiltArrayX = distance * (xPos * (cosf * cosb * cosb + sinb * sinb) + yPos * (cosf * cosb * sinb - cosb * sinb)) / \
                        (distance + xPos * sinf * cosb + yPos * sinf * sinb) / self.pixelSize[0] - iPos
        tiltArrayY = distance * (xPos * (cosf * sinb * cosb - cosb * sinb) + yPos * (cosf * sinb * sinb + cosb * cosb)) / \
                        (distance + xPos * sinf * cosb + yPos * sinf * sinb) / self.pixelSize[1] - jPos
        tiltedSpline = Spline()
        tiltedSpline.pixelSize = self.pixelSize
        tiltedSpline.grid = self.grid
        tiltedSpline.xDispArray = tiltArrayX
        tiltedSpline.yDispArray = tiltArrayY
        #tiltedSpline.array2spline(smoothing=1e-6, timing=True)
        if timing:
            print("Time for the generation of the distorted spline: %.3f sec" % (time.time() - startTime))
        return tiltedSpline


#    def setPixelSize(self, pixelSize):
#        """
#        sets the size of the pixel from a 2-tuple of floats expressed in microns.
#        """
#        if len(pixelSize) == 2 :
#            self.pixelSize = pixelSize
#    def getPixelSize(self):
#        """
#        @return: the size of the pixel from a 
#        @rtype: 2-tuple of floats expressed in microns.
#        """
#        return self.pixelSize
#    

    def setPixelSize(self, pixelSize):
        """
        sets the size of the pixel from a 2-tuple of floats expressed in meters.
        @param: pixel size in meter
        @type pixelSize: 2-tuple of float 
        """
        if len(pixelSize) == 2 :
            self.pixelSize = (pixelSize[0] * 1.0e6, pixelSize[1] * 1.0e6)


    def getPixelSize(self):
        """
        @return: the size of the pixel from a 2D detector
        @rtype: 2-tuple of floats expressed in meter.
        """
        return (self.pixelSize[0] * 1.0e-6, self.pixelSize[1] * 1.0e-6)


#    def horizontalFlip(self):
#        """calculate the flipped spline file interverting xmin and xmax
#        @return: another spline file"""
#        other = Spline()
#        other.xmin = self.xmin
#        other.xmax = self.xmax
#        other.ymin = self.ymin
#        other.ymax = self.ymax
#        other.pixelSize = self.pixelSize
#        other.grid = self.grid
#        other.xSplineKnotsX = [ self.xmax + self.xmin - x for x in self.xSplineKnotsX  ]
#        #other.xSplineKnotsX = self.xSplineKnotsX[:]
#        other.xSplineKnotsY = self.xSplineKnotsY[:]
#        other.xSplineCoeff = [ -i for i in self.xSplineCoeff]
#        other.ySplineKnotsX = [ self.xmax + self.xmin - x for x in self.xSplineKnotsX  ]
#        #other.ySplineKnotsX = self.ySplineKnotsX[:]
#        other.ySplineKnotsY = self.ySplineKnotsY[:]
#        other.ySplineCoeff = self.ySplineCoeff[:]
#        return other
#
#def xDispHorFlip(array):
#    """make an horizontal flip of the given X displacement array"""
#    return - numpy.fliplr(array)
#def yDispHorFlip(array):
#    """make an horizontal flip of the given Y displacement array"""
#    return numpy.fliplr(array)
#def xDispVerFlip(array):
#    """make a vertical flip of the given X displacement array"""
#    return numpy.flipud(array)
#def yDispVerFlip(array):
#    """make a vertical flip of the given Y displacement array"""
#    return - numpy.flipud(array)


if __name__ == '__main__':
#    """this is the main program if somebody wants to use this as a library"""
#
#
#
#
##    spline.write("test")
#    new = Spline()
#    new.pixelSize = spline.pixelSize
#    new.grid = spline.grid
#    new.xDispArray = xDispHorFlip(spline.xDispArray[:])
#    new.yDispArray = yDispHorFlip(spline.yDispArray[:])
#    new.array2spline(smoothing=10, timing=False)
#    print "matrix flipped", new
#    flipped = spline.horizontalFlip()
#    print "Spline flipped", flipped
#
#
#    print "---" * 50
#
#
#    print new.comparison(flipped, verbose=True)

#    new.write("new.spline")
#    new.xDispArray = None
#    new.yDispArray = None
#    new.spline2array(timing=True)
#    print new.comparison(spline, verbose=True)
    # Size of the image in pixels:
##########################################################    
#    spline = Spline()
#    spline.zeros(0, 0, 2000, 2000)
#    spline.spline2array()
#    spline.pixelSize = (100, 100)
#    spline.grid = 1

    CENTER = (1000, 1000)
    TILT = 10 #deg
    ROTATION_TILT = 0 #deg
    DISTANCE = 100 #mm
    SPLINE_FILE = "example.spline"
    for keyword in sys.argv[1:]:
        if os.path.isfile(keyword):
            SPLINE_FILE = keyword
        elif keyword.lower().find("center=") in [0, 1, 2]:
            CENTER = map(float, keyword.split("=")[1].split("x"))
        elif keyword.lower().find("dist=") in [0, 1, 2]:
            DISTANCE = float(keyword.split("=")[1])
        elif keyword.lower().find("tilt=") in [0, 1, 2]:
            TILT = float(keyword.split("=")[1])
        elif keyword.lower().find("rot=") in [0, 1, 2]:
            ROTATION_TILT = float(keyword.split("=")[1])


    spline = Spline()
    spline.read(SPLINE_FILE)
    print ("Original Spline: %s" % spline)
    spline.spline2array(timing=True)
    tilted = spline.tilt(CENTER, TILT, ROTATION_TILT, DISTANCE, timing=True)
    #tilted.write("tilted-t%i-p%i-d%i.spline" % (TILT, ROTATION_TILT, DISTANCE))
    tilted.writeEDF("%s-tilted-t%i-p%i-d%i" % (os.path.splitext(SPLINE_FILE)[0], TILT, ROTATION_TILT, DISTANCE))
#    for i in range(0, 14, 2):
#        tilted.array2spline(smoothing=(10.0 ** (-i)), timing=True)
#        tilted.write("tilted-t%i-p%i-d%i-s%i.spline" % (TILT, ROTATION_TILT, DISTANCE, i))
#        fromspline = Spline()
#        fromspline.read("tilted-t%i-p%i-d%i-s%i.spline" % (TILT, ROTATION_TILT, DISTANCE, i))
#        print fromspline.comparison(tilted, verbose=True)
#    spline = Spline()
#    spline.read("tilted-t%i-p%i-d%i.spline" % (TILT, ROTATION_TILT, DISTANCE))
#    spline.spline2array(timing=True)
#    print spline.comparison(tilted, verbose=True)
pyfai-0.3.5/pyFAI-src/__init__.py0000644001611600065110000000054211705103306015644 0ustar  kieffersoftversion = "0.3.5"
import sys, logging
logging.basicConfig()

if sys.version_info < (2, 6):
    logger = logging.getLogger("pyFAI.__init__")
    logger.error("pyFAI required a python version >= 2.6")
    raise RuntimeError("pyFAI required a python version >= 2.6, now we are running: %s" % sys.version)
from azimuthalIntegrator import AzimuthalIntegrator
pyfai-0.3.5/pyFAI-src/geometry.py0000644001611600065110000010230111705103306015734 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "21/12/2011"
__status__ = "beta"

import os, threading, logging
import numpy
from numpy import sin, cos, arccos, sqrt, radians, degrees
from spline import Spline
from utils import timeit
logger = logging.getLogger("pyFAI.geometry")



class Geometry(object):
    """
    This class is an azimuthal integrator based on P. Boesecke's geometry and 
    histogram algorithm by Manolo S. del Rio and V.A Sole
     
    """
    def __init__(self, dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=1, pixel2=1, splineFile=None):
        """
        @param dist: distance sample - detector plan (orthogonal distance, not along the beam), in meter.
        @param poni1: coordinate of the point of normal incidence along the detector's first dimension, in meter
        @param poni2: coordinate of the point of normal incidence along the detector's second dimension, in meter
        @param rot1: first rotation from sample ref to detector's ref, in radians
        @param rot2: second rotation from sample ref to detector's ref, in radians
        @param rot3: third rotation from sample ref to detector's ref, in radians
        @param pixel1: pixel size of the fist dimension of the detector,  in meter
        @param pixel2: pixel size of the second dimension of the detector,  in meter
        @param splineFile: file containing the geometric distortion of the detector. Overrides the pixel size.  
        """
        self._dist = dist
        self._poni1 = poni1
        self._poni2 = poni2
        self._rot1 = rot1
        self._rot2 = rot2
        self._rot3 = rot3
        self.pixel1 = pixel1
        self.pixel2 = pixel2
        self.param = [self._dist, self._poni1, self._poni2, self._rot1, self._rot2, self._rot3]
        self.chiDiscAtPi = True #position of the discontinuity of chi in radians, pi by default
        self._ttha = None
        self._dttha = None
        self._dssa = None
        self._chia = None
        self._dchia = None
        self._qa = None
        self._dqa = None
        self._corner4Da = None
        self._corner4Dqa = None
        self._wavelength = None
        self._splineCache = {} #key=(dx,xpoints,ypoints) value: ndarray
        self._oversampling = None
        self._sem = threading.Semaphore()

        if splineFile:
            self.splineFile = os.path.abspath(splineFile)
            self.spline = Spline(self.splineFile)
            #NOTA : X is axis 1 and Y is Axis 0 
            self.pixel2, self.pixel1 = self.spline.getPixelSize()
        else:
            self.splineFile = None
            self.spline = None


    def __repr__(self):
        self.param = [self._dist, self._poni1, self._poni2, self._rot1, self._rot2, self._rot3]
        lstTxt = ["Spline= %s\t PixelSize= %.3e, %.3e m" % (self.splineFile, self.pixel1, self.pixel2)]
        lstTxt.append("SampleDetDist= %.6em\tPONI= %.6e, %.6em\trot1=%.6f  rot2= %.6f  rot3= %.6f rad" % tuple(self.param))
        f2d = self.getFit2D()
        lstTxt.append("DirectBeamDist= %.3fmm\tCenter: x=%.3f, y=%.3f pix\tTilt=%.3f deg  TiltPlanRot= %.3f deg" %
                       (f2d["DirectBeamDist"], f2d["BeamCenterX"], f2d["BeamCenterY"], f2d["Tilt"], f2d["TiltPlanRot"]))
        return os.linesep.join(lstTxt)


    def _calcCatesianPositions(self, d1, d2, poni1=None, poni2=None):
        """
        Calculate the position in cartesian coordinate (centered on the PONI) 
        and in meter of a couple of coordinates. 
        The half pixel offset is taken into account here !!!
        
        @param d1: ndarray of dimention 1/2 containing the Y pixel positions
        @param d2: ndarray of dimention 1/2 containing the X pixel positions
        @param poni1: value in the Y direction of the poni coordinate (in meter) 
        @param poni2: value in the X direction of the poni coordinate (in meter) 
        @return: 2-arrays of same shape as d1 & d2 with the position in meter

        d1 and d2 must have the same shape, returned array will have the same shape.
        """
        if  poni1 is None:
            poni1 = self.poni1
        if  poni2 is None:
            poni2 = self.poni2

        if self.spline is None:
            dX = 0.
            dY = 0.
        else:
            if d2.ndim == 1:
                keyX = ("dX", tuple(d1), tuple(d2))
                keyY = ("dY", tuple(d1), tuple(d2))
                if keyX not in self._splineCache:
                    self._splineCache[keyX] = numpy.array([self.spline.splineFuncX(i2, i1) for i1, i2 in zip(d1 + 0.5, d2 + 0.5)], dtype="float64")
                if keyY not in self._splineCache:
                    self._splineCache[keyY] = numpy.array([self.spline.splineFuncY(i2, i1) for i1, i2 in zip(d1 + 0.5, d2 + 0.5)], dtype="float64")
                dX = self._splineCache[keyX]
                dY = self._splineCache[keyY]
            else:
                dX = self.spline.splineFuncX(d2 + 0.5, d1 + 0.5)
                dY = self.spline.splineFuncY(d2 + 0.5, d1 + 0.5)
        p1 = (self.pixel1 * (dY + 0.5 + d1)) - poni1
        p2 = (self.pixel2 * (dX + 0.5 + d2)) - poni2
        return p1, p2

    def tth(self, d1, d2, param=None):
        """
        Calculates the 2theta value for the center of a given pixel (or set of pixels)
        @param d1: position(s) in pixel in first dimension (c order)
        @type d1: scalar or array of scalar
        @param d2: position(s) in pixel in second dimension (c order)
        @type d2: scalar or array of scalar
        @return 2theta in radians 
        @rtype: floar or array of floats.
        """

        if param == None:
            param = self.param
        cosRot1 = cos(param[3])
        cosRot2 = cos(param[4])
        cosRot3 = cos(param[5])
        sinRot1 = sin(param[3])
        sinRot2 = sin(param[4])
        sinRot3 = sin(param[5])
        p1, p2 = self._calcCatesianPositions(d1, d2, param[1], param[2])

        tmp = arccos((param[0] * cosRot1 * cosRot2 - p2 * cosRot2 * sinRot1 + p1 * sinRot2) / \
                     (sqrt((-param[0] * cosRot1 * cosRot2 + p2 * cosRot2 * sinRot1 - p1 * sinRot2) ** 2 + \
                            (p1 * cosRot2 * cosRot3 + p2 * (cosRot3 * sinRot1 * sinRot2 - cosRot1 * sinRot3) - param[0] * (cosRot1 * cosRot3 * sinRot2 + sinRot1 * sinRot3)) ** 2 + \
                             (p1 * cosRot2 * sinRot3 - param[0] * (-cosRot3 * sinRot1 + cosRot1 * sinRot2 * sinRot3) + p2 * (cosRot1 * cosRot3 + sinRot1 * sinRot2 * sinRot3)) ** 2)))
        return tmp


    def qFunction(self, d1, d2, param=None):
        """
        Calculates the q value for the center of a given pixel (or set of pixels)
        @param d1: position(s) in pixel in first dimension (c order)
        @type d1: scalar or array of scalar
        @param d2: position(s) in pixel in second dimension (c order)
        @type d2: scalar or array of scalar
        @return q in in nm^(-1) 
        @rtype: float or array of floats.
        """

        if param == None:
            param = self.param
        cosRot1 = cos(param[3])
        cosRot2 = cos(param[4])
        cosRot3 = cos(param[5])
        sinRot1 = sin(param[3])
        sinRot2 = sin(param[4])
        sinRot3 = sin(param[5])
        p1, p2 = self._calcCatesianPositions(d1, d2, param[1], param[2])
        tmp = ((param[0] * cosRot1 * cosRot2 - p2 * cosRot2 * sinRot1 + p1 * sinRot2) / \
                     (sqrt((-param[0] * cosRot1 * cosRot2 + p2 * cosRot2 * sinRot1 - p1 * sinRot2) ** 2 + \
                            (p1 * cosRot2 * cosRot3 + p2 * (cosRot3 * sinRot1 * sinRot2 - cosRot1 * sinRot3) - param[0] * (cosRot1 * cosRot3 * sinRot2 + sinRot1 * sinRot3)) ** 2 + \
                             (p1 * cosRot2 * sinRot3 - param[0] * (-cosRot3 * sinRot1 + cosRot1 * sinRot2 * sinRot3) + p2 * (cosRot1 * cosRot3 + sinRot1 * sinRot2 * sinRot3)) ** 2)))

        return  2.0e-9 * numpy.pi * sqrt(1.0 - tmp ** 2) / self.wavelength


    def qArray(self, shape):
        """
        Generate an array of the given shape with q(i,j) for all elements.  
        """
        if self._qa is None:
            with self._sem:
                if self._qa is None:
                    self._qa = numpy.fromfunction(self.qFunction, shape, dtype="float32")
        return self._qa

    def qCornerFunct(self, d1, d2):
        """
        calculate the q_vector for any pixel corner
        """
        return self.qFunction(d1 - 0.5, d2 - 0.5)


    def tth_corner(self, d1, d2):
        """
        Calculates the 2theta value for the corner of a given pixel (or set of pixels)
        @param d1: position(s) in pixel in first dimension (c order)
        @type d1: scalar or array of scalar
        @param d2: position(s) in pixel in second dimension (c order)
        @type d2: scalar or array of scalar
        @return 2theta in radians 
        @rtype: floar or array of floats.
        """
        return self.tth(d1 - 0.5, d2 - 0.5)


    def twoThetaArray(self, shape):
        """
        Generate an array of the given shape with two-theta(i,j) for all elements.  
        """
        if self._ttha is None:
            with self._sem:
                if self._ttha is None:
                    self._ttha = numpy.fromfunction(self.tth, shape, dtype="float32")
        return self._ttha


    def chi(self, d1, d2):
        """
        Calculate the chi (azimuthal angle) for the centre of a pixel at coordinate d1,d2 
        which in the lab ref has coordinate:
        X1 = p1*Cos(rot2)*Cos(rot3) + p2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) -  L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))
        X2 = p1*Cos(rot2)*Sin(rot3) - L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) +  p2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))
        X3 = -(L*Cos(rot1)*Cos(rot2)) + p2*Cos(rot2)*Sin(rot1) - p1*Sin(rot2)
        hence tan(Chi) =  X2 / X1
        
        @param d1: pixel coordinate along the 1st dimention (C convention)
        @type d1: float or array of them
        @param d2: pixel coordinate along the 2nd dimention (C convention)
        @type d2: float or array of them
        @return: chi, the azimuthal angle in rad
        """
        cosRot1 = cos(self._rot1)
        cosRot2 = cos(self._rot2)
        cosRot3 = cos(self._rot3)
        sinRot1 = sin(self._rot1)
        sinRot2 = sin(self._rot2)
        sinRot3 = sin(self._rot3)
        L = self._dist
        p1, p2 = self._calcCatesianPositions(d1, d2, self.poni1, self.poni2)
        num = p1 * cosRot2 * cosRot3 + p2 * (cosRot3 * sinRot2 * sinRot2 - cosRot1 * sinRot3) - L * (cosRot1 * cosRot3 * sinRot2 + sinRot1 * sinRot3)
        den = p1 * cosRot2 * sinRot3 - L * (-(cosRot3 * sinRot1) + cosRot1 * sinRot2 * sinRot3) + p2 * (cosRot1 * cosRot3 + sinRot1 * sinRot2 * sinRot3)
        return numpy.arctan2(-num, den)
#        return numpy.arctan2(-den, num)

    def chi_corner(self, d1, d2):
        """
        Calculate the chi (azimuthal angle) for the corner of a pixel at coordinate d1,d2 
        which in the lab ref has coordinate:
        X1 = p1*Cos(rot2)*Cos(rot3) + p2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) -  L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))
        X2 = p1*Cos(rot2)*Sin(rot3) - L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) +  p2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))
        X3 = -(L*Cos(rot1)*Cos(rot2)) + p2*Cos(rot2)*Sin(rot1) - p1*Sin(rot2)
        hence tan(Chi) =  X2 / X1
        
        @param d1: pixel coordinate along the 1st dimention (C convention)
        @type d1: float or array of them
        @param d2: pixel coordinate along the 2nd dimention (C convention)
        @type d2: float or array of them
        @return: chi, the azimuthal angle in rad
        """
        return self.chi(d1 - 0.5, d2 - 0.5)

    def chiArray(self, shape):
        """
        Generate an array of the given shape with chi(i,j) (azimuthal angle) for all elements.  
        """
        if self._chia is None:
            if self.chiDiscAtPi:
                self._chia = numpy.fromfunction(self.chi, shape, dtype="float32")
            else:
                self._chia = numpy.fromfunction(self.chi, shape, dtype="float32") % (2 * numpy.pi)
        return self._chia


    def cornerArray(self, shape):
        """
        Generate a 3D array of the given shape with (i,j) (azimuthal angle) for all elements.  
        """
################################################################################
# TODO : add the center to the 4 corners when splitpixel algo is ready
################################################################################
#        tth_center = self.twoThetaArray(shape)
#        chi_center = self.chiArray(shape)
        if self._corner4Da is None:
            with self._sem:
                if self._corner4Da is None:
                    self._corner4Da = numpy.zeros((shape[0], shape[1], 4, 2), dtype="float32")
                    chi = numpy.fromfunction(self.chi_corner, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    tth = numpy.fromfunction(self.tth_corner, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    self._corner4Da[:, :, 0, 0] = tth[:-1, :-1]
                    self._corner4Da[:, :, 0, 1] = chi[:-1, :-1]
                    self._corner4Da[:, :, 1, 0] = tth[1:, :-1]
                    self._corner4Da[:, :, 1, 1] = chi[1:, :-1]
                    self._corner4Da[:, :, 2, 0] = tth[1:, 1:]
                    self._corner4Da[:, :, 2, 1] = chi[1:, 1:]
                    self._corner4Da[:, :, 3, 0] = tth[:-1, 1:]
                    self._corner4Da[:, :, 3, 1] = chi[:-1, 1:]
#                    self._corner4Da[:, :, 4, 0] = tth_center
#                    self._corner4Da[:, :, 4, 1] = chi_center
        return self._corner4Da


    def cornerQArray(self, shape):
        """
        Generate a 3D array of the given shape with (i,j) (azimuthal angle) for all elements.  
        """
################################################################################
# TODO : add the center to the 4 corners when splitpixel algo is ready
################################################################################
#        q_center = self.qArray(shape)
#        chi_center = self.chiArray(shape)
        if self._corner4Dqa is None:
            with self._sem:
                if self._corner4Dqa is None:
                    self._corner4Dqa = numpy.zeros((shape[0], shape[1], 4, 2), dtype="float32")
                    chi = numpy.fromfunction(self.chi_corner, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    tth = numpy.fromfunction(self.qCornerFunct(shape[0] + 1, shape[1] + 1), dtype="float32")
                    self._corner4Dqa[:, :, 0, 0] = tth[:-1, :-1]
                    self._corner4Dqa[:, :, 0, 1] = chi[:-1, :-1]
                    self._corner4Dqa[:, :, 1, 0] = tth[1:, :-1]
                    self._corner4Dqa[:, :, 1, 1] = chi[1:, :-1]
                    self._corner4Dqa[:, :, 2, 0] = tth[1:, 1:]
                    self._corner4Dqa[:, :, 2, 1] = chi[1:, 1:]
                    self._corner4Dqa[:, :, 3, 0] = tth[:-1, 1:]
                    self._corner4Dqa[:, :, 3, 1] = chi[:-1, 1:]
#                    self._corner4Dqa[:, :, 4, 0] = q_center
#                    self._corner4Dqa[:, :, 4, 1] = chi_center
        return self._corner4Dqa



    def delta2Theta(self, shape):
        """
        Generate a 3D array of the given shape with (i,j) with the max distance between the center and any corner in 2 theta  
        """
        tth_center = self.twoThetaArray(shape)
        if self._dttha is None:
            with self._sem:
                if self._dttha is None:
                    tth_corner = numpy.fromfunction(self.tth_corner, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    delta = numpy.zeros([shape[0], shape[1], 4], dtype="float32")
                    delta[:, :, 0] = abs(tth_corner[:-1, :-1] - tth_center)
                    delta[:, :, 1] = abs(tth_corner[1:, :-1] - tth_center)
                    delta[:, :, 2] = abs(tth_corner[1:, 1:] - tth_center)
                    delta[:, :, 3] = abs(tth_corner[:-1, 1:] - tth_center)
                    self._dttha = delta.max(axis=2)
        return self._dttha


    def deltaChi(self, shape):
        """
        Generate a 3D array of the given shape with (i,j) with the max distance between the center and any corner in chi-angle  
        """
        chi_center = self.chiArray(shape)
        if self._dchia is None:
            with self._sem:
                if self._dchia is None:
                    twoPi = (2 * numpy.pi)
                    chi_corner = numpy.fromfunction(self.chi_corner, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    delta = numpy.zeros([shape[0], shape[1], 4], dtype="float32")
                    delta[:, :, 0] = numpy.minimum(((chi_corner[:-1, :-1] - chi_center) % twoPi), ((chi_center - chi_corner[:-1, :-1]) % twoPi))
                    delta[:, :, 1] = numpy.minimum(((chi_corner[1: , :-1] - chi_center) % twoPi), ((chi_center - chi_corner[1: , :-1]) % twoPi))
                    delta[:, :, 2] = numpy.minimum(((chi_corner[1: , 1: ] - chi_center) % twoPi), ((chi_center - chi_corner[1: , 1: ]) % twoPi))
                    delta[:, :, 3] = numpy.minimum(((chi_corner[:-1, 1: ] - chi_center) % twoPi), ((chi_center - chi_corner[:-1, 1: ]) % twoPi))
                    self._dchia = delta.max(axis=2)
        return self._dchia


    def deltaQ(self, shape):
        """
        Generate a 3D array of the given shape with (i,j) with the max distance between the center and any corner in q_vector  
        """
        q_center = self.qArray(shape)
        if self._dqa is None:
            with self._sem:
                if self._dqa is None:
                    q_corner = numpy.fromfunction(self.qCornerFunct, (shape[0] + 1, shape[1] + 1), dtype="float32")
                    delta = numpy.zeros([shape[0], shape[1], 4], dtype="float32")
                    delta[:, :, 0] = abs(q_corner[:-1, :-1] - q_center)
                    delta[:, :, 1] = abs(q_corner[1:, :-1] - q_center)
                    delta[:, :, 2] = abs(q_corner[1:, 1:] - q_center)
                    delta[:, :, 3] = abs(q_corner[:-1, 1:] - q_center)
                    self._dqa = delta.max(axis=2)
        return self._dqa


    def diffSolidAngle(self, d1, d2):
        """
        calulate the solid angle of the current pixels
        """
        p1 = (0.5 + d1) * self.pixel1 - self._poni1
        p2 = (0.5 + d2) * self.pixel2 - self._poni2
        ds = 1.0

        ########################################################################
        # Nota: the solid angle correction should be done in flat field correction
        # Here is dual-correction 
        ########################################################################

#        if self.spline is None:
#            ds = 1.0
#        else:
#            max1 = d1.max() + 1
#            max2 = d2.max() + 1
#            sX = self.spline.splineFuncX(numpy.arange(max2 + 1) , numpy.arange(max1) + 0.5)
#            sY = self.spline.splineFuncY(numpy.arange(max2) + 0.5 , numpy.arange(max1 + 1))
#            dX = sX[:, 1:] - sX[:, :-1]
#            dY = sY[1:, : ] - sY[:-1, :]
#            ds = (dX + 1.0) * (dY + 1.0)
        dsa = ds * (self._dist) / sqrt(self._dist ** 2 + p1 ** 2 + p2 ** 2)
        return dsa


    def solidAngleArray(self, shape):
        """
        Generate an array of the given shape with the solid angle of the current element two-theta(i,j) for all elements.  
        """
        if self._dssa is None:
            self._dssa = numpy.fromfunction(self.diffSolidAngle, shape, dtype="float32")
        return self._dssa

    def save(self, filename):
        """
        Save the refined parameters.
        @param filename: name of the file where to save the parameters
        @type filename: string
        """
        try:
            with open(filename, "a") as f:
                f.write("# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis %s" % os.linesep)
                f.write("PixelSize1: %s%s" % (self.pixel1, os.linesep))
                f.write("PixelSize2: %s%s" % (self.pixel2, os.linesep))
                f.write("Distance: %s%s" % (self._dist, os.linesep))
                f.write("Poni1: %s%s" % (self._poni1, os.linesep))
                f.write("Poni2: %s%s" % (self._poni2, os.linesep))
                f.write("Rot1: %s%s" % (self._rot1, os.linesep))
                f.write("Rot2: %s%s" % (self._rot2, os.linesep))
                f.write("Rot3: %s%s" % (self._rot3, os.linesep))
                f.write("SplineFile: %s%s" % (self.splineFile, os.linesep))
                if self._wavelength is not None:
                    f.write("Wavelength: %s%s" % (self._wavelength, os.linesep))
        except IOError:
            logger.error("IOError while writing to file %s" % filename)
    write = save


    def load(self, filename):
        """
        Load the refined parameters from a file.
        @param filename: name of the file to load
        @type filename: string
        """
        for line in open(filename):
            if line.startswith("#") or (":" not in line):
                continue
            words = line.split(":", 1)

            key = words[0].strip().lower()
            try:
                value = words[1].strip()
            except Exception as error:#IGNORE:W0703:
                logger.error("Error %s with line: %s" % (error, line))
            if key == "pixelsize1":
                self.pixel1 = float(value)
            elif key == "pixelsize2":
                self.pixel2 = float(value)
            elif key == "distance":
                self._dist = float(value)
            elif key == "poni1":
                self._poni1 = float(value)
            elif key == "poni2":
                self._poni2 = float(value)
            elif key == "rot1":
                self._rot1 = float(value)
            elif key == "rot2":
                self._rot2 = float(value)
            elif key == "rot3":
                self._rot3 = float(value)
            elif key == "wavelength":
                self.wavelength = float(value)
            elif key == "splinefile":
                if value.lower() != "none":
                    self.splineFile = os.path.abspath(value)
                    self.spline = Spline(self.splineFile)
                    #NOTA : X is axis 1 and Y is Axis 0 
                    self.pixel2, self.pixel1 = self.spline.getPixelSize()
        self.param = [self._dist, self._poni1, self._poni2, self._rot1, self._rot2, self._rot3]
        self.reset()
    read = load

    def getPyFai(self):
        """
        return the parameter set from the PyFAI geometry as a dictionary
        """
        return {"dist":self._dist,
                "poni1":self._poni1,
                "poni2":self._poni2,
                "rot1":self._rot1,
                "rot2":self._rot2,
                "rot3":self._rot3,
                "pixel1":self.pixel1,
                "pixel2":self.pixel2,
                "splineFile":self.splineFile}

    def setPyFai(self, **kwargs):
        """
        set the geometry from a pyFAI-like dict
        """
        for key in ["dist", "poni1", "poni2", "rot1", "rot2", "rot3", "pixel1", "pixel2", "splineFile"]:
            if key in kwargs:
                setattr(self, key, kwargs[key])
        self.param = [self._dist, self._poni1, self._poni2, self._rot1, self._rot2, self._rot3]
        self.chiDiscAtPi = True #position of the discontinuity of chi in radians, pi by default
        self.reset()
        self._wavelength = None
        self._splineCache = {} #key=(dx,xpoints,ypoints) value: ndarray
        self._oversampling = None
        if self.splineFile:
            self.splineFile = os.path.abspath(self.splineFile)
            self.spline = Spline(self.splineFile)
            #NOTA : X is axis 1 and Y is Axis 0 
            self.pixel2, self.pixel1 = self.spline.getPixelSize()
        else:
            self.splineFile = None
            self.spline = None


    def getFit2D(self):
        """
        return a dict with parameters compatible with fit2D geometry 
        """
        cosTilt = cos(self._rot1) * cos(self._rot2)
        sinTilt = sqrt(1 - cosTilt * cosTilt)
        cosTpr = max(-1, (min(1, -cos(self._rot2) * sin(self._rot1) / sinTilt)))
        sinTpr = sin(self._rot2) / sinTilt
        direct = 1.0e3 * self._dist / cosTilt
        tilt = degrees(arccos(cosTilt))
        if sinTpr < 0:
            tpr = -degrees(arccos(cosTpr))
        else:
            tpr = degrees(arccos(cosTpr))

        centerX = (self._poni2 + self._dist * sinTilt / cosTilt * cosTpr) / self.pixel2
        if abs(tilt) < 1e-5:
            centerY = (self._poni1) / self.pixel1
        else:
            centerY = (self._poni1 + self._dist * sinTilt / cosTilt * sinTpr) / self.pixel1
        return {"DirectBeamDist":direct,
                "BeamCenterX":centerX,
                "BeamCenterY": centerY,
                "Tilt": tilt,
                "TiltPlanRot": tpr }


    def setFit2d(self, direct, centerX, centerY, tilt=0., tiltPlanRotation=0., pixelX=None, pixelY=None, splineFile=None):
        """
        Set the Fit2D-like parameter set: For geometry description see  HPR 1996 (14) pp-240 
        @param direct: direct distance from sample to detector along the incident beam (in millimeter as in fit2d) 
        @param tilt: tilt in degrees 
        @param tiltPlanRotation: Rotation (in degrees) of the tilt plan arround the Z-detector axis 
                * 0deg -> Y does not move, +X goes to Z<0
                * 90deg -> X does not move, +Y goes to Z<0
                * 180deg -> Y does not move, +X goes to Z>0
                * 270deg -> X does not move, +Y goes to Z>0
                
        @param pixelX,pixelY: as in fit2d they ar given in micron, not in meter
        @param centerX, centerY: pixel position of the beam center
        @param splineFile: name of the file containing the spline
        """
        cosTilt = cos(radians(tilt))
        sinTilt = sin(radians(tilt))
        cosTpr = cos(radians(tiltPlanRotation))
        sinTpr = sin(radians(tiltPlanRotation))
        if splineFile is None:
            if pixelX is not None:
                self.pixel1 = pixelY * 1.0e-6
            if pixelY is not None:
                self.pixel2 = pixelX * 1.0e-6
        else:
            self.splineFile = splineFile
            self.spline = Spline(self.splineFile)
            #NOTA : X is axis 1 and Y is Axis 0 
            self.pixel2, self.pixel1 = self.spline.getPixelSize()
        self._dist = direct * cosTilt * 1.0e-3
        self._poni1 = centerY * self.pixel1 - direct * sinTilt * sinTpr * 1.0e-3
        self._poni2 = centerX * self.pixel2 - direct * sinTilt * cosTpr * 1.0e-3
        rot2 = numpy.arcsin(sinTilt * sinTpr) # or pi-#
        rot1 = numpy.arccos(min(1.0, max(-1.0, (cosTilt / numpy.sqrt(1 - sinTpr * sinTpr * sinTilt * sinTilt))))) # + or -
        if cosTpr * sinTilt > 0:
            rot1 = -rot1
        assert abs(cosTilt - cos(rot1) * cos(rot2)) < 1e-6
        if tilt == 0:
            rot3 = 0
        else:
            rot3 = numpy.arccos(min(1.0, max(-1.0, (cosTilt * cosTpr * sinTpr - cosTpr * sinTpr) / numpy.sqrt(1 - sinTpr * sinTpr * sinTilt * sinTilt)))) # + or -
        self._rot1 = rot1
        self._rot2 = rot2
        self._rot3 = rot3
        self.reset()

    def setChiDiscAtZero(self):
        """
        Set the position of the discontinuity of the chi axis between 0 and 2pi.
        By default it is between pi and -pi
        
        """
        self.chiDiscAtPi = False
        self._chia = None
        self._corner4Da = None
        self._corner4Dqa = None

    def setChiDiscAtPi(self):
        """
        Set the position of the discontinuity of the chi axis between -pi and +pi.
        This is the default behavour
        
        """
        self.chiDiscAtPi = True
        self._chia = None
        self._corner4Da = None
        self._corner4Dqa = None

    def setOversampling(self, iOversampling):
        """
        set the oversampling factor
        """
        if self._oversampling is None:
            lastOversampling = 1.0
        else:
            lastOversampling = float(self._oversampling)

        self._oversampling = iOversampling
        self._ttha = None
        self._dssa = None
        self._chia = None
        self._qa = None
        self.pixel1 /= self._oversampling / lastOversampling
        self.pixel2 /= self._oversampling / lastOversampling


    def oversampleArray(self, myarray):
        origShape = myarray.shape
        origType = myarray.dtype
        new = numpy.zeros((origShape[0] * self._oversampling, origShape[1] * self._oversampling)).astype(origType)
        for i in range(self._oversampling):
            for j in range(self._oversampling):
                new[i::self._oversampling, j::self._oversampling] = myarray
        return new

    def reset(self):
        """
        reset most arrays that are cached: used when a parameter changes. 
        """
#        with self._sem:
        self._ttha = None
        self._dttha = None
        self._dssa = None
        self._chia = None
        self._dchia = None
        self._qa = None
        self._dqa = None
        self._corner4Da = None
        self._corner4Dqa = None

################################################################################
# Accessors and public properties of the class
################################################################################

    def set_dist(self, value):
        if isinstance(value, float):
            self._dist = value
        else:
            self._dist = float(value)
        self.reset()
    def get_dist(self):
        return self._dist
    dist = property(get_dist, set_dist)

    def set_poni1(self, value):
        if isinstance(value, float):
            self._poni1 = value
        else:
            self._poni1 = float(value)
        self.reset()
    def get_poni1(self):
        return self._poni1
    poni1 = property(get_poni1, set_poni1)
    def set_poni2(self, value):
        if isinstance(value, float):
            self._poni2 = value
        else:
            self._poni2 = float(value)
        self.reset()
    def get_poni2(self):
        return self._poni2
    poni2 = property(get_poni2, set_poni2)
    def set_rot1(self, value):
        if isinstance(value, float):
            self._rot1 = value
        else:
            self._rot1 = float(value)
        self.reset()
    def get_rot1(self):
        return self._rot1
    rot1 = property(get_rot1, set_rot1)
    def set_rot2(self, value):
        if isinstance(value, float):
            self._rot2 = value
        else:
            self._rot2 = float(value)
        self.reset()
    def get_rot2(self):
        return self._rot2
    rot2 = property(get_rot2, set_rot2)
    def set_rot3(self, value):
        if isinstance(value, float):
            self._rot3 = value
        else:
            self._rot3 = float(value)
        self.reset()
    def get_rot3(self):
        return self._rot3
    rot3 = property(get_rot3, set_rot3)
    def set_wavelength(self, value):
        if isinstance(value, float):
            self._wavelength = value
        else:
            self._wavelength = float(value)
        self._qa = None
        self._dqa = None
    def get_wavelength(self):
        if self._wavelength is None:
            raise RuntimeWarning("Using wavelength without having defined it previously ... excpect to fail !")
        return self._wavelength
    wavelength = property(get_wavelength, set_wavelength)

    def get_ttha(self):
        return self._ttha
    def set_ttha(self, value):
        logger.error("You are not allowed to modify 2theta array")
    def del_ttha(self):
        self._ttha = None
    ttha = property(get_ttha, set_ttha, del_ttha, "2theta array in cache")
    def get_chia(self):
        return self._chia
    def set_chia(self, value):
        logger.error("You are not allowed to modify chi array")
    def del_chia(self):
        self._chia = None
    chia = property(get_chia, set_chia, del_chia, "chi array in cache")
    def get_dssa(self):
        return self._dssa
    def set_dssa(self, value):
        logger.error("You are not allowed to modify solid angle array")
    def del_dssa(self):
        self._dssa = None
    dssa = property(get_dssa, set_dssa, del_dssa, "solid angle array in cache")
    def get_qa(self):
        return self._qa
    def set_qa(self, value):
        logger.error("You are not allowed to modify Q array")
    def del_qa(self):
        self._qa = None
    qa = property(get_qa, set_qa, del_qa, "Q array in cache")
pyfai-0.3.5/pyFAI-src/peakPicker.py0000644001611600065110000006165111705103306016173 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal 
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/12/2011"
__status__ = "development"

import os, sys, threading, logging, gc
from math                   import ceil, sqrt, pi
import numpy
from scipy.optimize         import fmin
from scipy.ndimage.filters  import median_filter
from scipy.ndimage          import label#, binary_closing, binary_opening, binary_erosion #,binary_propagation
#import matplotlib
import pylab
import fabio
from utils                  import relabel, gaussian_filter, binning, unBinning
from bilinear               import bilinear
logger = logging.getLogger("pyFAI.peakPicker")
if os.name != "nt":
    WindowsError = RuntimeError
TARGET_SIZE = 1024

################################################################################
# PeakPicker
################################################################################
class PeakPicker(object):
    def __init__(self, strFilename):
        """
        @param: input image filename
        """
        self.strFilename = strFilename
        self.data = fabio.open(strFilename).data.astype("float32")
        self.shape = self.data.shape
        self.points = ControlPoints()
        self.lstPoints = []
        self.fig = None
        self.fig2 = None
        self.fig2sp = None
        self.ax = None
        self.ct = None
        self.msp = None
        self.massif = Massif(self.data)
        self._sem = threading.Semaphore()
        self._semGui = threading.Semaphore()
        self.defaultNbPoints = 100

    def gui(self, log=False):
        """
        @param log: show z in log scale
        """
        if self.fig is None:
            self.fig = pylab.plt.figure()
        self.ax = self.fig.add_subplot(111);
        if log:
            self.ax.imshow(numpy.log(1.0 + self.data - self.data.min()));
        else:
            self.ax.imshow(self.data);
        self.fig.show()
        self.fig.canvas.mpl_connect('button_press_event', self.onclick)

    def load(self, filename):
        """
        load a filename and plot data on the screen (if GUI)
        """
        self.points.load(filename)
        if self.ax is not None:
            for idx, points in enumerate(self.points._points):
                if len(points) > 0:
                    pt0x = points[0][1]
                    pt0y = points[0][0]
                    self.ax.annotate("%i" % (idx), xy=(pt0x, pt0y), xytext=(pt0x + 10, pt0y + 10),
                                     color="white", arrowprops=dict(facecolor='white', edgecolor='white'))

                    npl = numpy.array(points)
                    self.ax.plot(npl[:, 1], npl[:, 0], "o", scalex=False, scaley=False)

    def onclick(self, event):
        def annontate(x, x0=None, idx=None):
            """
            Call back method to annotate the figure while calculation are going on ...
            @param x: coordinates 
            @param x0: coordinates of the starting point
            """
            if x0 is None:
                self.ax.annotate(".", xy=(x[1], x[0]), color="black")
            else:
                self.ax.annotate("%i" % (len(self.points)), xy=(x[1], x[0]), xytext=(x0[1], x0[0]), color="white",
                     arrowprops=dict(facecolor='white', edgecolor='white'),)
                self.fig.canvas.draw()

        self._sem.acquire()
        if event.button == 3: #right click
            x0 = event.xdata
            y0 = event.ydata
            listpeak = self.massif.find_peaks([y0, x0], self.defaultNbPoints, annontate, self.massif_contour)
            if len(listpeak) == 0:
                logging.warning("No peak found !!!")
                self._sem.release()
                return
            npl = numpy.array(listpeak)
            self.ax.plot(npl[:, 1], npl[:, 0], "o", scalex=False, scaley=False)

            logging.info("Added %3i points to group #%i" % (len(listpeak), len(self.points)))
            self.points.append(listpeak)
            self.fig.show()
            sys.stdout.flush()
        elif event.button == 2: #center click
            a = self.points.pop()
#            for i in a:
            if len(self.ax.texts) > 0:
                self.ax.texts.pop()
            if len(self.ax.lines) > 0:
                self.ax.lines.pop()
            self.fig.show()
            logging.info("Removing point group #%i (%5.1f %5.1f) containing %i subpoints" % (len(self.points), a[0][0], a[0][1], len(a)))
            sys.stdout.flush()
        self._sem.release()

    def readFloatFromKeyboard(self, text, dictVar):
        """
        Read float from the keyboard ....
        @param text: string to be displayed
        @param dictVar: dict of this type: {1: [set_dist_min],3: [set_dist_min, set_dist_guess, set_dist_max]}
        """
        fromkb = raw_input(text).strip()
        try:
            vals = [float(i) for i in fromkb.split()]
        except:
            logging.error("Error in parsing values")
        else:
            found = False
            for i in dictVar:
                if len(vals) == i:
                    found = True
                    for j in range(i):
                        dictVar[i][j](vals[j])
            if not found:
                logging.error("You should provide the good number of floats")


    def finish(self, filename=None):
        """
        Ask the 2theta values for the given points
        """
        logging.info("Please use the GUI and Right-click on the peaks to mark them")

        raw_input("Please press enter when you are happy; to fill in 2theta values" + os.linesep)
        self.points.readAngleFromKeyboard()
        if filename is not None:
            self.points.save(filename)
        self.lstPoints = self.points.getList()
        return self.lstPoints


    def contour(self, data):
        if self.fig is None:
            logging.warning("No diffraction image available => not showing the contour")
        else:
            if self.msp is not None:
                if len(self.msp.images) > 1:
                    self.msp.images.pop()
                    self.msp = None
            if self.ct is None:
                self.ct = self.fig.add_subplot(111)
            else:
                while len(self.ct.images) > 1:
                    self.ct.images.pop()
                while len(self.ct.collections) > 0:
                    self.ct.collections.pop()

            try:
                self.ct.contour(data)
            except MemoryError:
                logging.error("Sorry but your computer does NOT have enough memory to display the 2-theta contour plot")
            self.fig.show()

    def massif_contour(self, data):
        if self.fig is None:
            logging.error("No diffraction image available => not showing the contour")
        else:
            tmp = 100 * (1 - data.astype("uint8"))
            mask = numpy.zeros((data.shape[0], data.shape[1], 4), dtype="uint8")

            mask[:, :, 0] = tmp
            mask[:, :, 1] = tmp
            mask[:, :, 2] = tmp
            mask[:, :, 3] = tmp
            if self.msp is None:
                self.msp = self.fig.add_subplot(111)
            else:
                if len(self.msp.images) > 1:
                    self.msp.images.pop()
            try:
                self.msp.imshow(mask, cmap="gray")
            except MemoryError:
                logging.error("Sorry but your computer does NOT have enough memory to display the massif plot")
            #self.fig.show()
            self.fig.canvas.draw()

    def closeGUI(self):
        if self.fig is not None:
            self.fig.clear()
            self.fig = None
            gc.collect()

################################################################################
# ControlPoints
################################################################################
class ControlPoints(object):
    """
    This class contains a set of control points with (optionaly) their diffrection 2Theta angle  
    """
    def __init__(self, filename=None):
        if filename is not None:
            self.load(filename)
        self._angles = [] #angles are enforced in radians, conversion from degrees or q-space nm-1 are done on the fly
        self._points = []
        self._sem = threading.Semaphore()
        self._wavelength = None

    def __repr__(self):
        self.check()
        lstOut = ["ControlPoints instance containing %i group of point:" % len(self)]
        if self._wavelength is not None:
            lstOut = "wavelength: %s" % self._wavelength
        for angle, points in zip(self._angles, self._points):
            lstOut.append("%s: %s" % (angle, points))
        return os.linesep.join(lstOut)

    def __len__(self):
        return len(self._angles)

    def check(self):
        """
        check internal consistency of the class 
        """
        if len(self._angles) != len(self._points):
            logger.error("in ControlPoints: length of the two arrays are not consistent!!! angle: %i points: %s ",
                           len(self._angles), len(self._points))
    def reset(self):
        """
        remove all stored values and resets them to default 
        """
        with self._sem:
            self._wavelength = None
            self._angles = [] #angles are enforced in radians, conversion from degrees or q-space nm-1 are done on the fly
            self._points = []

    def append(self, points, angle=None):
        """
        @param point: list of points
        @param angle: 2-theta angle in radians 
        """
        with self._sem:
            self._angles.append(angle)
            self._points.append(points)
    append_2theta_deg = append

    def append_2theta_deg(self, points, angle=None):
        """
        @param point: list of points
        @param angle: 2-theta angle in degrees 
        """
        with self._sem:
            self._angles.append(pi * angle / 180.)
            self._points.append(points)

    def pop(self, idx=None):
        """
        Remove the set of points at given index (by default the last)
        @param idx: poistion of the point to remove
        """
        out = None
        if idx is None:
            with self._sem:
                self._angles.pop()
                out = self._points.pop()
        else:
            with self._sem:
                self._angles.pop(idx)
                out = self._points.pop(idx)
        return out

    def save(self, filename):
        """
        Save a set of control points to a file
        @param filename: name of the file
        @return: None
        """
        self.check()
        with self._sem:
            lstOut = ["# set of control point used by pyFAI to calibrate the geometry of a scattering experiment",
                      "#angles are in radians, wavelength in meter and positions in pixels"]

            if self._wavelength is not None:
                lstOut = "wavelength: %s" % self._wavelength
            for idx, angle, points in zip(range(self.__len__()), self._angles, self._points):
                lstOut.append("")
                lstOut.append("New group of points: %i" % idx)
                lstOut.append("2theta: %s" % angle)
                for point in points:
                    lstOut.append("point: x=%s y=%s" % (point[1], point[0]))
            with open(filename, "w") as f:
                f.write(os.linesep.join(lstOut))

    def load(self, filename):
        """
        load all control points from a file 
        """
        if not os.path.isfile(filename):
            logger.error("ControlPoint.load: No such file %s", filename)
            return
        self.reset()
        tth = None
        points = []
        for line in open(filename, "r"):
            if line.startswith("#"):
                continue
            elif ":" in line:
                key, value = line.split(":", 1)
                value = value.strip()
                key = key.strip().lower()
                if key == "wavelength":
                    try:
                        self._wavelength = float(value)
                    except:
                        logger.error("ControlPoints.load: unable to convert to float %s (wavelength)", value)
                elif key == "2theta":
                    if value.lower() == "none":
                        tth = None
                    else:
                        try:
                            tth = float(value)
                        except:
                            logger.error("ControlPoints.load: unable to convert to float %s (2theta)", value)
                elif key == "point":
                    vx = None
                    vy = None
                    if "x=" in value:
                        vx = value[value.index("x=") + 2:].split()[0]
                    if "y=" in value:
                        vy = value[value.index("y=") + 2:].split()[0]
                    if (vx is not None) and (vy is not None):
                        try:
                            x = float(vx)
                            y = float(vy)
                        except:
                            logger.error("ControlPoints.load: unable to convert to float %s (point)", value)
                        else:
                            points.append([y, x])
                elif key.startswith("new"):
                    if len(points) > 0:
                        with self._sem:
                            self._angles.append(tth)
                            self._points.append(points)
                            tth = None
                            points = []
                else:
                    logger.error("Unknown key: %s", key)
        if len(points) > 0:
            self._angles.append(tth)
            self._points.append(points)


    def getList(self):
        """
        Retrieve the list of control points suitable for geometry refinement
        """
        lstOut = []
        for tth, points in zip(self._angles, self._points):
            lstOut += [[pt[0], pt[1], tth] for pt in points]
        return lstOut


    def readAngleFromKeyboard(self):
        """
        Ask the 2theta values for the given points
        """
        last2Theta = None
        for idx, tth, point in zip(range(self.__len__()), self._angles, self._points):
            bOk = False
            while not bOk:
                if tth is not None:
                    last2Theta = numpy.rad2deg(tth)
                res = raw_input("Point group #%2i (%i points)\t (%6.1f,%6.1f) \t [default=%s] 2Theta= " % (idx, len(point), point[0][1], point[0][0], last2Theta)).strip()
                if res == "":
                    res = last2Theta
                try:
                    tth = float(res)
                except (ValueError, TypeError):
                    logging.error("I did not understand your 2theta value")
                else:
                    if tth > 0:
                        last2Theta = tth
                        self._angles[idx] = numpy.deg2rad(tth)
                        bOk = True


    def setWavelength(self, value=None):
        with self._sem:
            if self._wavelength is None:
                self._wavelength = value
            else:
                logger.warning("Forbidden to change the wavelength once it is fixed !!!!")
    def getWavelength(self): return self._wavelength
    wavelength = property(getWavelength, setWavelength)

################################################################################
# Massif
################################################################################
class Massif(object):
    """
    A massif is defined as an area around a peak, it is used to find neighbouring peaks
    """
    def __init__(self, data=None):
        """
        
        """
        if isinstance(data, (str, unicode)) and os.path.isfile(data):
            self.data = fabio.open(data).data.astype("float32")
        elif  isinstance(data, fabio.fabioimage.fabioimage):
            self.data = data.data.astype("float32")
        else:
            try:
                self.data = data.astype("float32")
            except Exception as error:
                logger.error("Unable to understand this type of data %s: %s", data, error)
        self._bilin = bilinear(self.data)
        self._blured_data = None
        self._median_data = None
        self._labeled_massif = None
        self._number_massif = None
        self._valley_size = None
        self._binned_data = None
        self.binning = None #Binning is 2-list usually
        self._sem = threading.Semaphore()
        self._sem_label = threading.Semaphore()
        self._sem_binning = threading.Semaphore()
        self._sem_median = threading.Semaphore()


    def nearest_peak(self, x):
        """
        @returns the coordinates of the nearest peak       
        """
        x = numpy.array(x, dtype="float32")
        out = fmin(self._bilin.f_cy, x, disp=0).round().astype(numpy.int)
        if isinstance(out, numpy.ndarray):
            res = [int(i) for idx, i in enumerate(out) if 0 <= i < self.data.shape[idx] ]
        else:
            print out
            res = [int(i) for idx, i in enumerate(out) if 0 <= i < self.data.shape[idx] ]
        if len(res) == 2:
            return res


    def calculate_massif(self, x):
        """
        defines a map of the massif around x and returns the mask
        """
        labeled = self.getLabeledMassif()
        if labeled[x[0], x[1]] != labeled.max():
            return (labeled == labeled[x[0], x[1]])


    def find_peaks(self, x, nmax=200, annotate=None, massif_contour=None, stdout=sys.stdout):
        """
        All in one function that finds a maximum from the given seed (x) 
        then calculates the region extension and extract position of the neighboring peaks.  
        @param x: seed for the calculation, input coordinates
        @param nmax: maximum number of peak per region
        @param annotate: call back method taking number of points + coordinate as input. 
        @param massif_contour: callback to show the contour of a massif with the given index. 
        @param stdout: this is the file where output is written by default.
        @return: list of peaks
        """
        listpeaks = []
        region = self.calculate_massif(x)
        if region is None:
            logger.error("You picked a background point at %s", x)
            return listpeaks
        xinit = self.nearest_peak(x)
        if xinit is None:
            logger.error("Unable to find peak in the vinicy of %s", x)
            return listpeaks
        else:
            if not region[xinit[0], xinit[1]]:
                logger.error("Nearest peak %s is not in the same region  %s", xinit, x)
                return listpeaks

            if annotate is not None:
                try:
                    annotate(xinit, x)
                except Exception as error:
                    logger.error("Error in annotate %i: %i %i. %s" , len(listpeaks), xinit[0], xinit[1], error)

        listpeaks.append(xinit)
        idx = numpy.arange(region.size)
        idx.shape = region.shape
        regionIdx = idx[region]
        numpy.random.shuffle(regionIdx)
        nmax = min(nmax, int(ceil(sqrt(region.sum()))))
        if massif_contour is not None:
            try:
                massif_contour(region)
            except (WindowsError, MemoryError) as error:
                logger.error("Error in plotting region: %s", error)
        nbFailure = 0
        dim1 = region.shape[1]
        for idx in  regionIdx:
            x0 = idx // dim1
            x1 = idx % dim1
            if not region[x0, x1]:
                logger.warning("Input point (%s,%s) not in region !!!! " % (x0, x1))
            xopt = self.nearest_peak([x0, x1])
            if xopt is None:
                nbFailure += 1
                continue
            if (region[xopt[0], xopt[1]]) and not (xopt in listpeaks):
                stdout.write("[ %4i, %4i ] --> [ %4i, %4i ] after %3i iterations %s" % (x0, x1, xopt[0], xopt[1], nbFailure, os.linesep))
                listpeaks.append(xopt)

                nbFailure = 0
            else:
                nbFailure += 1
            if (len(listpeaks) > nmax) or (nbFailure > 2 * nmax):
                break
        return listpeaks


    def initValleySize(self):
        if self._valley_size is None:
            self.valley_size = max(5., max(self.data.shape) / 50.)


    def getValleySize(self):
        if self._valley_size is None:
            self.initValleySize()
        return self._valley_size
    def setValleySize(self, size):
        self._valley_size = size
        t = threading.Thread(target=self.getLabeledMassif)
        t.start()
    def delValleySize(self):
        self._valley_size = None
        self._blured_data = None
    valley_size = property(getValleySize, setValleySize, delValleySize, "Defines the minimum distance between two massifs")

    def getBinnedData(self):
        """
        @return binned data 
        """
        if self._binned_data is None:
            with self._sem_binning:
                if self._binned_data is None:
                    logger.info("Image size is %s", self.data.shape)
                    self.binning = []
                    for i in self.data.shape:
                        if i % TARGET_SIZE == 0:
                            self.binning.append(max(1, i // TARGET_SIZE))
                        else:
                            for j in range(i // TARGET_SIZE - 1, 0, -1):
                                if i % j == 0:
                                    self.binning.append(max(1, j))
                                    break
                            else:
                                self.binning.append(1)
#                    self.binning = max([max(1, i // TARGET_SIZE) for i in self.data.shape])
                    logger.info("Binning size is %s", self.binning)
                    self._binned_data = binning(self.data, self.binning)
        return self._binned_data

    def getMedianData(self):
        if self._median_data is None:
            with self._sem_median:
                if self._median_data is None:
                    self._median_data = median_filter(self.data, 3)
                    if logger.getEffectiveLevel() == logging.DEBUG:
                        fabio.edfimage.edfimage(data=self._median_data).write("median_data.edf")
        return self._median_data

    def getBluredData(self):
        if self._blured_data is None:
            with self._sem:
                if self._blured_data is None:
                    logger.debug("Blurring image with kernel size: %s" , self.valley_size)
                    self._blured_data = gaussian_filter(self.getBinnedData(), [self.valley_size / i for i in  self.binning], mode="reflect")
                    if logger.getEffectiveLevel() == logging.DEBUG:
                        fabio.edfimage.edfimage(data=self._blured_data).write("blured_data.edf")
        return self._blured_data

    def getLabeledMassif(self, pattern=None):
        if self._labeled_massif is None:
            with self._sem_label:
                if self._labeled_massif is None:
                    if pattern is None:
                        pattern = [[1] * 3] * 3#[[0, 1, 0], [1, 1, 1], [0, 1, 0]]#[[1] * 3] * 3
                    logger.debug("Labeling all massifs. This takes some time !!!")
                    labeled_massif, self._number_massif = label((self.getBinnedData() > self.getBluredData()), pattern)
                    logger.info("Labeling found %s massifs." % self._number_massif)
                    if logger.getEffectiveLevel() == logging.DEBUG:
                        fabio.edfimage.edfimage(data=labeled_massif).write("labeled_massif_small.edf")
                    relabeled = relabel(labeled_massif, self.getBinnedData(), self.getBluredData())
                    if logger.getEffectiveLevel() == logging.DEBUG:
                            fabio.edfimage.edfimage(data=relabeled).write("relabeled_massif_small.edf")
                    self._labeled_massif = unBinning(relabeled, self.binning)
                    if logger.getEffectiveLevel() == logging.DEBUG:
                        fabio.edfimage.edfimage(data=self._labeled_massif).write("labeled_massif.edf")
                    logger.info("Labeling found %s massifs." % self._number_massif)
        return self._labeled_massif
pyfai-0.3.5/pyFAI-src/ocl_azim_kernel.cl0000644001611600065110000002416411705103306017216 0ustar  kieffersoft/*
 *   Project: Azimuthal regroupping OpenCL kernel for pyFAI.
 *
 *
 *   Copyright (C) 2011 European Synchrotron Radiation Facility
 *                           Grenoble, France
 *
 *   Principal authors: D. Karkoulis (karkouli@esrf.fr)
 *   Last revision: 03/06/2011
 *   
 *   Contributing author: Jerome Kieffer (jerome.kieffer@esrf.eu)
 *    
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   and the GNU Lesser General Public License  along with this program.
 *   If not, see .
 */

//OpenCL extensions are silently defined by opencl compiler at compile-time:
#ifdef cl_amd_printf
  #pragma OPENCL EXTENSION cl_amd_printf : enable
#elif defined(cl_intel_printf)
  #pragma OPENCL EXTENSION cl_intel_printf : enable
#else
  #define printf(...)
#endif

#define UINT_ACC 1000

// #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
// #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable
// #pragma OPENCL EXTENSION cl_khr_fp64 : enable

__kernel void
create_histo_binarray(__global float *tth, __global int *bin_array, __global float* tth_min_max){

  uint tid,gid;
  int cbin;
  uint x,y;
  float tth_min,tth_max;
  uint segment_offset;
  __local int l_b[BINS];

  tid=get_local_id(0);
  gid=get_global_id(0);

  //Load tth min and max from slow global to fast register cache
  tth_min = tth_min_max[0];
  tth_max = tth_min_max[1];

  //Normalize tth to the [0,1] range, taking into account for the normalisation that the min value
  // can be positive bigger than 0.
  cbin = (int)( ( (tth[gid] - tth_min)*(BINS-1) ) / (tth_max - tth_min) );
  if(cbin>=2047 || cbin<1){
    printf("tid %u gid %u tth %f tth_min_max %f %f cbin %d\n",tid,gid,tth[gid],tth_min_max[0],tth_min_max[1],cbin);
    printf("tthmax - tthmin %f\n",tth_min_max[1] - tth_min_max[0]);
  }
  barrier(CLK_LOCAL_MEM_FENCE);

  segment_offset =  (gid/BLOCK_SIZE)*BINS;

  //Initialise the local memory buffer of the bins array.
  for(uint i=0;i<(BINS/BLOCK_SIZE);i++){
    l_b[tid + i*BLOCK_SIZE]=0;
  }

  barrier(CLK_LOCAL_MEM_FENCE);
  atom_inc(&l_b[cbin]);

  barrier(CLK_LOCAL_MEM_FENCE);
  for(uint i=0;i<(BINS/BLOCK_SIZE);i++){
    bin_array[tid + i*BLOCK_SIZE + segment_offset]=l_b[tid + i*BLOCK_SIZE];
    barrier(CLK_LOCAL_MEM_FENCE);

  }

}


__kernel void
create_histo_intensity(__global float *tth, __global float *SolidAngle, __global float *intensity, \
                         __global float *histogram, __global int* bin_array, __global float* tth_min_max, __global float *int_min_max){

  uint tid,gid;
  int cbin;
  uint x,y;
  float tth_min,tth_max;
  float int_max;
  uint segment_offset;
  uint intensity_add;
  float intensity_correction;
  __local unsigned int l_b[BINS];

  tid=get_local_id(0);
  gid=get_global_id(0);

  //Load min and max from slow global memory to fast register cache
  tth_min = tth_min_max[0];
  tth_max = tth_min_max[1];
  int_max = int_min_max[1];

  //Normalize tth to the [0,1] range and assign to a bin, taking into account that the min value
  // can be positive bigger than 0.
  cbin = (int)( ( (tth[gid] - tth_min)*(BINS-1) ) / (tth_max - tth_min) );

  //When running on cpu, quick and dirty check for boundaries
  if(cbin>=2047 || cbin<1){
    printf("tid %u gid %u tth %f tth_min_max %f %f cbin %d\n",tid,gid,tth[gid],tth_min_max[0],tth_min_max[1],cbin);
    printf("tthmax - tthmin %f\n",tth_min_max[1] - tth_min_max[0]);
  }
  barrier(CLK_LOCAL_MEM_FENCE);

  segment_offset =  (gid/BLOCK_SIZE)*BINS;

  //Initialise the local memory buffer of the histogram array.
  for(uint i=0;i<(BINS/BLOCK_SIZE);i++){
    l_b[tid + i*BLOCK_SIZE]=0;
  }

  barrier(CLK_LOCAL_MEM_FENCE);
  intensity_correction =  (intensity[gid] /SolidAngle[gid]);
  intensity_add = (uint)((intensity_correction)*UINT_ACC/int_max);
  atom_add(&l_b[cbin],intensity_add);

  barrier(CLK_LOCAL_MEM_FENCE);
  for(uint i=0;i<(BINS/BLOCK_SIZE);i++){
    histogram[tid + i*BLOCK_SIZE + segment_offset]=((float)(l_b[tid + i*BLOCK_SIZE]))/UINT_ACC*int_max;
    barrier(CLK_LOCAL_MEM_FENCE);

  }

}

//create_histo creates (Nx / BLOCK_SIZE) partial histograms which need to be reduced to a single histogram.
// This is a straightforward naive approach and not so fast. The more optimised approach of reduction is used in
// get_max_intensity kernel. Eventually reduce_histo will be converted in the same way.
__kernel void reduce_binarray(__global int *bin_array){
  
  uint bsum=0;
  uint gid=get_global_id(0);

  for(uint i=0;i0; s>>=1){
      if(tid0; s>>=1){
      if(tid0; s>>=1){
    if(tid0; s>>=1){
    if(tid s0 or k1 > s1:
        raise RuntimeError("Makes little sense to apply a kernel (%i,%i)larger than the image (%i,%i)" % (k0, k1, s0, s1))
    output = numpy.zeros((s0 + 2 * k0, s1 + 2 * k1), dtype=dtype) + float(cval)
    output[k0:k0 + s0, k1:k1 + s1] = input
    if mode in  ["reflect", "mirror"]:
    #4 corners
        output[s0 + k0:, s1 + k1:] = input[-1:-k0 - 1:-1, -1:-k1 - 1:-1]
        output[:k0, :k1] = input[k0 - 1::-1, k1 - 1::-1]
        output[:k0, s1 + k1:] = input[k0 - 1::-1, s1 - 1: s1 - k1 - 1:-1]
        output[s0 + k0:, :k1] = input[s0 - 1: s0 - k0 - 1:-1, k1 - 1::-1]
    #4 sides
        output[k0:k0 + s0, :k1] = input[:s0, k1 - 1::-1]
        output[:k0, k1:k1 + s1] = input[k0 - 1::-1, :s1]
        output[-k0:, k1:s1 + k1] = input[:s0 - k0 - 1:-1, :]
        output[k0:s0 + k0, -k1:] = input[:, :s1 - k1 - 1:-1]
    elif mode == "nearest":
    #4 corners
        output[s0 + k0:, s1 + k1:] = input[-1, -1]
        output[:k0, :k1] = input[0, 0]
        output[:k0, s1 + k1:] = input[0, -1]
        output[s0 + k0:, :k1] = input[-1, 0]
    #4 sides
        output[k0:k0 + s0, :k1] = numpy.outer(input[:, 0], numpy.ones(k1))
        output[:k0, k1:k1 + s1] = numpy.outer(numpy.ones(k0), input[0, :])
        output[-k0:, k1:s1 + k1] = numpy.outer(numpy.ones(k0), input[-1, :])
        output[k0:s0 + k0, -k1:] = numpy.outer(input[:, -1], numpy.ones(k1))
    return output



def relabel(label, data, blured, max_size=None):
    """
    Relabel limits the number of region in the label array. 
    They are ranked relatively to their max(I0)-max(blur(I0)
    
    @param label: a label array coming out of scipy.ndimage.measurement.label
    @param data: an array containing the raw data
    @param blured: an array containing the blured data
    @param max_size: the max number of label wanted
    @return array like label
    """
    max_label = label.max()
    a, b, c, d = relabelCython.countThem(label, data, blured)
    count = d
    sortCount = count.argsort()
    invSortCount = sortCount[-1::-1]
    invCutInvSortCount = numpy.zeros(max_label + 1, dtype=int)
    for i, j in enumerate(list(invSortCount[:max_size])):
        invCutInvSortCount[j] = i
    f = lambda i:invCutInvSortCount[i]
    return f(label)


def averageImages(listImages, output=None, threshold=0.1, minimum=None, maximum=None):
    """
    Takes a list of filenames and create an average frame discarding all saturated pixels.
    
    @param listImages: list of string representing the filenames
    @param output: name of the optional output file
    @param threshold: what is the upper limit? all pixel > max*(1-threshold) are discareded.
    @param minimum: minimum valid value or True
    @param maximum: maximum valid value 
    """
    ld = len(listImages)
    sumImg = None
    for fn in listImages:
        logger.info("Reading %s" % fn)
        ds = fabio.open(fn).data
        logger.debug("Intensity range for %s is %s --> %s", fn, ds.min(), ds.max())
        shape = ds.shape
        if sumImg is None:
            sumImg = numpy.zeros((shape[0], shape[1]), dtype="float64")
        sumImg += removeSaturatedPixel(ds.astype("float32"), threshold, minimum, maximum)
    datared = (sumImg / float(ld)).astype("float32")
    if output is None:
        prefix = ""
        for ch in zip(*listImages):
            c = ch[0]
            good = True
            for i in ch:
                if i != c:
                    good = False
                    break
            if good:
                prefix += c
            else:
                break
        output = ("merge%02i-" % ld) + prefix + ".edf"
    logger.debug("Intensity range in merged dataset : %s --> %s", datared.min(), datared.max())
    fabio.edfimage.edfimage(data=datared,
                            header={"merged": ", ".join(listImages)}).write(output)
    return output


def boundingBox(img):
    """
    Tries to guess the bounding box around a valid massif  
    
    @param img: 2D array like
    @return: 4-typle (d0_min, d1_min, d0_max, d1_max) 
    """
    img = img.astype(numpy.int)
    img0 = (img.sum(axis=1) > 0).astype(numpy.int)
    img1 = (img.sum(axis=0) > 0).astype(numpy.int)
    dimg0 = img0[1:] - img0[:-1]
    min0 = dimg0.argmax()
    max0 = dimg0.argmin() + 1
    dimg1 = img1[1:] - img1[:-1]
    min1 = dimg1.argmax()
    max1 = dimg1.argmin() + 1
    if max0 == 1:
        max0 = img0.size
    if max1 == 1:
        max1 = img1.size
    return (min0, min1, max0, max1)


def removeSaturatedPixel(ds, threshold=0.1, minimum=None, maximum=None):
    """
    @param ds: a dataset as  ndarray

    @param threshold: what is the upper limit? all pixel > max*(1-threshold) are discareded.
    @param minimum: minumum valid value (or True for auto-guess) 
    @param maximum: maximum valid value 
    @return: another dataset
    """
    shape = ds.shape
    if ds.dtype == numpy.uint16:
        maxt = (1.0 - threshold) * 65535.0
    elif ds.dtype == numpy.int16:
        maxt = (1.0 - threshold) * 32767.0
    elif ds.dtype == numpy.uint8:
        maxt = (1.0 - threshold) * 255.0
    elif ds.dtype == numpy.int8:
        maxt = (1.0 - threshold) * 127.0
    else:
        if maximum is  None:
            maxt = (1.0 - threshold) * ds.max()
        else:
            maxt = maximum
    if maximum is not None:
        maxt = min(maxt, maximum)
    invalid = (ds > maxt)
    if minimum:
        if  minimum is True: #automatic guess of the best minimum TODO: use the HWHM to guess the minumum...
            data_min = ds.min()
            x, y = numpy.histogram(numpy.log(ds - data_min + 1.0), bins=100)
            f = interp1d((y[1:] + y[:-1]) / 2.0, -x, bounds_error=False, fill_value= -x.min())
            max_low = fmin(f, y[1], disp=0)
            max_hi = fmin(f, y[-1], disp=0)
            if max_hi > max_low:
                f = interp1d((y[1:] + y[:-1]) / 2.0, x, bounds_error=False)
                min_center = fminbound(f, max_low, max_hi)
            else:
                min_center = max_hi
            minimum = float(numpy.exp(y[((min_center / y) > 1).sum() - 1])) - 1.0 + data_min
            logger.debug("removeSaturatedPixel: best minimum guessed is %s", minimum)
        ds[ds < minimum] = minimum
        ds -= minimum #- 1.0

    if invalid.sum(dtype=int) == 0:
        logger.debug("No saturated area where found")
        return ds
    gi = ndimage.morphology.binary_dilation(invalid)
    lgi, nc = ndimage.label(gi)
    if nc > 100:
        logger.warning("More than 100 saturated zones were found on this image !!!!")
    for zone in range(nc + 1):
        dzone = (lgi == zone)
        if dzone.sum(dtype=int) > ds.size // 2:
            continue
        min0, min1, max0, max1 = boundingBox(dzone)
        ksize = min(max0 - min0, max1 - min1)
        subset = ds[max(0, min0 - 4 * ksize):min(shape[0], max0 + 4 * ksize), max(0, min1 - 4 * ksize):min(shape[1], max1 + 4 * ksize)]
        while subset.max() > maxt:
            subset = ndimage.median_filter(subset, ksize)
        ds[max(0, min0 - 4 * ksize):min(shape[0], max0 + 4 * ksize), max(0, min1 - 4 * ksize):min(shape[1], max1 + 4 * ksize)] = subset
    fabio.edfimage.edfimage(data=ds).write("removeSaturatedPixel.edf")
    return ds


def binning(inputArray, binsize):
    """
    @param inputArray: input ndarray
    @param binsize: int or 2-tuple representing the size of the binning
    @return: binned input ndarray
    """
    inputSize = inputArray.shape
    outputSize = []
    assert(len(inputSize) == 2)
    if isinstance(binsize, int):
        binsize = (binsize, binsize)
    for i, j in zip(inputSize, binsize):
        assert(i % j == 0)
        outputSize.append(i // j)

    if numpy.array(binsize).prod() < 50:
        out = numpy.zeros(tuple(outputSize))
        for i in xrange(binsize[0]):
            for j in xrange(binsize[1]):
                out += inputArray[i::binsize[0], j::binsize[1]]
    else:
        temp = inputArray.copy()
        temp.shape = (outputSize[0], binsize[0], outputSize[1], binsize[1])
        out = temp.sum(axis=3).sum(axis=1)
    return out


def unBinning(binnedArray, binsize):
    """
    @param binnedArray: input ndarray
    @param binsize: 2-tuple representing the size of the binning
    @return: unBinned input ndarray
    """
    if isinstance(binsize, int):
        binsize = (binsize, binsize)
    outputShape = []
    for i, j in zip(binnedArray.shape, binsize):
        outputShape.append(i * j)
    out = numpy.zeros(tuple(outputShape), dtype=binnedArray.dtype)
    for i in xrange(binsize[0]):
        for j in xrange(binsize[1]):
            out[i::binsize[0], j::binsize[1]] += binnedArray
    return out


pyfai-0.3.5/pyFAI-src/histogram_ocl.py0000644001611600065110000000000011705103306016724 0ustar  kieffersoftpyfai-0.3.5/pyFAI-src/azimuthalIntegrator.py0000755001611600065110000013453511705103306020157 0ustar  kieffersoft#!/usr/bin/env python
# -*- coding: utf8 -*-
#
#    Project: Azimuthal integration 
#             https://forge.epn-campus.eu/projects/azimuthal
#
#    File: "$Id$"
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "21/12/2011"
__status__ = "beta"

import os, logging
import numpy
from numpy import degrees
from geometry import Geometry
import fabio
from spline import Spline
from utils import timeit
logger = logging.getLogger("pyFAI.azimuthalIntegrator")



class AzimuthalIntegrator(Geometry):
    """
    This class is an azimuthal integrator based on P. Boesecke's geometry and 
    histogram algorithm by Manolo S. del Rio and V.A Sole
    
    All geometry calculation are done in the Geometry class
    
    """
    def __init__(self, dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=1, pixel2=1, splineFile=None):
        """
        @param dist: distance sample - detector plan (orthogonal distance, not along the beam), in meter.
        @param poni1: coordinate of the point of normal incidence along the detector's first dimension, in meter
        @param poni2: coordinate of the point of normal incidence along the detector's second dimension, in meter
        @param rot1: first rotation from sample ref to detector's ref, in radians
        @param rot2: second rotation from sample ref to detector's ref, in radians
        @param rot3: third rotation from sample ref to detector's ref, in radians
        @param pixel1: pixel size of the fist dimension of the detector,  in meter
        @param pixel2: pixel size of the second dimension of the detector,  in meter
        @param splineFile: file containing the geometric distortion of the detector. Overrides the pixel size.  
        """
        Geometry.__init__(self, dist, poni1, poni2, rot1, rot2, rot3, pixel1, pixel2, splineFile)
        self._nbPixCache = {} #key=shape, value: array

        self.maskfile = None    #just a placeholder
        self.background = None  #just a placeholder
        self.flatfield = None   #just a placeholder
        self.darkcurrent = None   #just a placeholder
        self.header = None

        self._backgrounds = {}  #dict for caching
        self._flatfields = {}
        self._darkcurrents = {}


        if splineFile:
            self.splineFile = os.path.abspath(splineFile)
            self.spline = Spline(self.splineFile)
            #NOTA : X is axis 1 and Y is Axis 0 
            self.pixel2, self.pixel1 = self.spline.getPixelSize()
        else:
            self.splineFile = None
            self.spline = None


    def makeMask(self, data, mask=None, dummy=None, delta_dummy=None, invertMask=None):
        """
        Combines a mask
        
        For the mask: 1 for good pixels, 0 for bas pixels
        @param data: input array of 
        @param mask: input mask 
        @param dummy: value of dead pixels
        @param delta_dumy: precision of dummy pixels
        @param invertMask: to force inversion of the input mask
        """
        shape = data.shape
        if (mask is None) and (self.maskfile is not None) and os.path.isfile(self.maskfile):
            mask = fabio.open(self.maskfile).data
        if (mask is None) and (self.maskfile is None):
            mask = numpy.ones(shape, dtype=bool)
        else:
            mask_min = mask.min()
            mask_max = mask.max()
            if  mask_min < 0 and mask_max == 0:
                mask = (mask.clip(-1, 0) + 1).astype(bool)
            else:
                mask = mask.astype(bool)
            if mask.sum(dtype=int) > mask.size:
                logger.debug("Mask likely to be inverted as more than half pixel are masked !!!")
                mask = (1 - mask).astype(bool)
        if (mask.shape != shape):
            try:
                mask = mask[:shape[0], :shape[1]]
            except Exception as error:#IGNORE:W0703
                logger.error("Mask provided has wrong shape: expected: %s, got %s, error: %s" % (shape, mask.shape, error))
                mask = numpy.ones(shape, dtype=bool)
        if invertMask:
            mask = (1 - mask)
        if dummy is not None:
            if delta_dummy is None:
                mask *= (data != dummy)
            else:
                mask *= abs(data - dummy) > delta_dummy
        return mask.astype(bool)



    def xrpd_numpy(self, data, nbPt, filename=None, correctSolidAngle=True, tthRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the powder diffraction pattern from a set of data, an image. Numpy implementation

        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt: number of points in the output pattern
        @type nbPt: integer
        @param filename: file to save data in
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param tthRange: The lower and upper range of 2theta. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type tthRange: (float, float), optional
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: (2theta, I) in degrees
        @rtype: 2-tuple of 1D arrays
        """
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        tth = self.twoThetaArray(data.shape)[mask]

        if nbPt not in self._nbPixCache:
            ref, b = numpy.histogram(tth, nbPt)
            self._nbPixCache[nbPt] = numpy.maximum(1, ref)
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask].astype("float64")
        else:
            data = data[mask].astype("float64")

        val, b = numpy.histogram(tth,
                                 bins=nbPt,
                                 weights=data,
                                 range=tthRange)
        tthAxis = degrees(b[1:].astype("float32") + b[:-1].astype("float32")) / 2.0
        I = val / self._nbPixCache[nbPt]
        if filename:
            try:
                with open(filename, "w") as openedfile:
                    openedfile.writelines(["%s\t%s%s" % (t, i, os.linesep) for t, i in zip(tthAxis, I)])
            except IOError:
                logger.error("IOError: unable to write to file %s" % filename)
        return tthAxis, I



    def xrpd_cython(self, data, nbPt, filename=None, correctSolidAngle=True, tthRange=None, mask=None, dummy=None, delta_dummy=None, pixelSize=None):
        """
        Calculate the powder diffraction pattern from a set of data, an image. Cython implementation
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt: number of points in the output pattern
        @type nbPt: integer
        @param filename: file to save data in
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param tthRange: The lower and upper range of the 2theta. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type tthRange: (float, float), optional
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: (2theta, I) in degrees
        @rtype: 2-tuple of 1D arrays
        """

        try:
            import histogram #IGNORE:F0401
        except ImportError as error:#IGNORE:W0703
            logger.error("Import error (%s), falling back on old method !" % error)
            return self.xrpd_numpy(data, nbPt, filename, correctSolidAngle, tthRange)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        tth = self.twoThetaArray(data.shape)[mask]
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        if dummy is None:
            dummy = 0.0
        tthAxis, I, a, b = histogram.histogram(pos=tth,
                                                   weights=data,
                                                   bins=nbPt,
                                                   bin_range=tthRange,
                                                   pixelSize_in_Pos=pixelSize,
                                                   dummy=dummy)
        tthAxis = numpy.degrees(tthAxis)
        if filename:
            open(filename, "w").writelines(["%s\t%s%s" % (t, i, os.linesep) for t, i in zip(tthAxis, I)])
        return tthAxis, I

    @timeit
    def xrpd_splitBBox(self, data, nbPt, filename=None, correctSolidAngle=True,
                       tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the powder diffraction pattern from a set of data, an image. Cython implementation
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt: number of points in the output pattern
        @type nbPt: integer
        @param filename: file to save data in ascii format 2 column
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param tthRange: The lower and upper range of the 2theta. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type tthRange: (float, float), optional
        @param chiRange: The lower and upper range of the chi angle. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type chiRange: (float, float), optional
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: (2theta, I) in degrees
        @rtype: 2-tuple of 1D arrays
        """
        try:
            import splitBBox  #IGNORE:F0401
        except ImportError as error:#IGNORE:W0703
            logger.error("Import error (%s), falling back on old method !" % error)
            return self.xrpd_numpy(data, nbPt, filename, correctSolidAngle, tthRange)
        if chiRange is not None:
            chi = self.chiArray(data.shape)[mask]
            dchi = self.deltaChi(data.shape)[mask]
        else:
            chi = None
            dchi = None
        tth = self.twoThetaArray(data.shape)
        dtth = self.delta2Theta(data.shape)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        if dummy is None:
            dummy = 0.0
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if chiRange is not None:
            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])
        if correctSolidAngle: #outPos, outMerge, outData, outCount
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        tthAxis, I, a, b = splitBBox.histoBBox1d(weights=data,
                                                 pos0=tth[mask],
                                                 delta_pos0=dtth[mask],
                                                 pos1=chi,
                                                 delta_pos1=dchi,
                                                 bins=nbPt,
                                                 pos0Range=tthRange,
                                                 pos1Range=chiRange,
                                                 dummy=dummy)
        tthAxis = numpy.degrees(tthAxis)
        if filename:
            open(filename, "w").writelines(["%s\t%s%s" % (t, i, os.linesep) for t, i in zip(tthAxis, I)])
        return tthAxis, I


    def xrpd_splitPixel(self, data, nbPt, filename=None, correctSolidAngle=True,
                        tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the powder diffraction pattern from a set of data, an image. 
        
        Cython implementation
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt: number of points in the output pattern
        @type nbPt: integer
        @param filename: file to save data in
        @type filename: string
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: (2theta, I) in degrees
        @rtype: 2-tuple of 1D arrays

        """
        try:
            import splitPixel#IGNORE:F0401
        except ImportError as error:
            logger.error("Import error %s , falling back on simple histogram !" % error)
            return self.xrpd_cython(data, nbPt, filename, correctSolidAngle, tthRange, mask, dummy, delta_dummy)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        pos = self.cornerArray(data.shape)[mask]
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data [mask]
        if dummy is None:
            dummy = 0.0
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if chiRange is not None:
            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])


        tthAxis, I, a, b = splitPixel.fullSplit1D(pos=pos,
                                                  weights=data,
                                                  bins=nbPt,
                                                  pos0Range=tthRange,
                                                  pos1Range=chiRange,
                                                  dummy=dummy)
        tthAxis = numpy.degrees(tthAxis)
        if filename:
            open(filename, "w").writelines(["%s\t%s%s" % (t, i, os.linesep) for t, i in zip(tthAxis, I)])
        return tthAxis, I
    #Default implementation:
    xrpd = xrpd_splitBBox


    def xrpd2_numpy(self, data, nbPt2Th, nbPtChi=360, filename=None, correctSolidAngle=True,
                         tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the 2D powder diffraction pattern (2Theta,Chi) from a set of data, an image
        
        Pure numpy implementation (VERY SLOW !!!)
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt2Th: number of points in the output pattern in the Radial (horizontal) axis (2 theta)
        @type nbPt: integer
        @param nbPtChi: number of points in the output pattern along the Azimuthal (vertical) axis (chi) 
        @type nbPtChi: integer
        @param filename: file to save data in
        @type filename: string
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: azimuthaly regrouped data, 2theta pos and chipos
        @rtype: 3-tuple of ndarrays
        """
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        tth = self.twoThetaArray(data.shape)[mask]
        chi = self.chiArray(data.shape)[mask]
        bins = (nbPtChi, nbPt2Th)
        if bins not in self._nbPixCache:
            ref, binsChi, bins2Th = numpy.histogram2d(chi, tth, bins=list(bins))
            self._nbPixCache[bins] = numpy.maximum(1.0, ref)
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        if tthRange is not None:
            tthRange = [numpy.deg2rad(i) for i in tthRange]
        else:
            tthRange = [numpy.deg2rad(tth.min()), numpy.deg2rad(tth.max())]
        if chiRange is not None:
            chiRange = [numpy.deg2rad(i) for i in chiRange]
        else:
            chiRange = [numpy.deg2rad(chi.min()), numpy.deg2rad(chi.max())]

        val, binsChi, bins2Th = numpy.histogram2d(chi, tth,
                                                  bins=list(bins),
                                                  weights=data,
                                                  range=[chiRange, tthRange])
        I = val / self._nbPixCache[bins]
        return I, bins2Th, binsChi

    def xrpd2_histogram(self, data, nbPt2Th, nbPtChi=360, filename=None, correctSolidAngle=True,
                              tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the 2D powder diffraction pattern (2Theta,Chi) from a set of data, an image
        
        Cython implementation: fast but incaccurate
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt2Th: number of points in the output pattern in the Radial (horizontal) axis (2 theta)
        @type nbPt: integer
        @param nbPtChi: number of points in the output pattern along the Azimuthal (vertical) axis (chi) 
        @type nbPtChi: integer
        @param filename: file to save data in
        @type filename: string
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: azimuthaly regrouped data, 2theta pos and chipos
        @rtype: 3-tuple of ndarrays
        """

        try:
            import histogram#IGNORE:F0401
        except ImportError as error:
            logger.error("Import error %s , falling back on numpy histogram !" % error)
            return self.xrpd2_numpy(data=data, nbPt2Th=nbPt2Th, nbPtChi=nbPtChi,
                                    filename=filename, correctSolidAngle=correctSolidAngle,
                                    tthRange=tthRange, chiRange=chiRange, mask=mask, dummy=dummy,
                                    delta_dummy=delta_dummy)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        tth = self.twoThetaArray(data.shape)[mask]
        chi = self.chiArray(data.shape)[mask]
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        if dummy is None:
            dummy = 0.0
        I, binsChi, bins2Th, val, count = histogram.histogram2d(pos0=chi,
                                                                pos1=tth,
                                                                bins=(nbPtChi, nbPt2Th),
                                                                weights=data,
                                                                split=1,
                                                                dummy=dummy)
        bins2Th = numpy.degrees(bins2Th)
        binsChi = numpy.degrees(binsChi)
        if filename:
            self.save2D(filename, I, bins2Th, binsChi)
        return I, bins2Th, binsChi



    def xrpd2_splitBBox(self, data, nbPt2Th, nbPtChi=360, filename=None, correctSolidAngle=True,
                         tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the 2D powder diffraction pattern (2Theta,Chi) from a set of data, an image
        
        Split pixels according to their coordinate and a bounding box
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt2Th: number of points in the output pattern in the Radial (horizontal) axis (2 theta)
        @type nbPt: integer
        @param nbPtChi: number of points in the output pattern along the Azimuthal (vertical) axis (chi) 
        @type nbPtChi: integer
        @param filename: file to save data in
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param tthRange: The lower and upper range of the 2theta. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type tthRange: (float, float), optional
        @param chiRange: The lower and upper range of the azimuthal angle. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type chiRange: (float, float), optional
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
        @rtype: 3-tuple of ndarrays
        """
        try:
            import splitBBox#IGNORE:F0401
        except ImportError as error:
            logger.error("Import error %s , falling back on simple histogram !" % error)
            return self.xrpd2_histogram(data=data, nbPt2Th=nbPt2Th, nbPtChi=nbPtChi,
                                        filename=filename, correctSolidAngle=correctSolidAngle,
                                        tthRange=tthRange, chiRange=chiRange, mask=mask, dummy=dummy, delta_dummy=delta_dummy)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        tth = self.twoThetaArray(data.shape)[mask]
        chi = self.chiArray(data.shape)[mask]
        dtth = self.delta2Theta(data.shape)[mask]
        dchi = self.deltaChi(data.shape)[mask]
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if chiRange is not None:
            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])
        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        if dummy is None:
            dummy = 0.0
        I, bins2Th, binsChi, a, b = splitBBox.histoBBox2d(weights=data,
                                                          pos0=tth,
                                                          delta_pos0=dtth,
                                                          pos1=chi,
                                                          delta_pos1=dchi,
                                                          bins=(nbPt2Th, nbPtChi),
                                                          pos0Range=tthRange,
                                                          pos1Range=chiRange,
                                                          dummy=dummy)
        bins2Th = numpy.degrees(bins2Th)
        binsChi = numpy.degrees(binsChi)
        if filename:
            self.save2D(filename, I, bins2Th, binsChi)
        return I, bins2Th, binsChi

    def xrpd2_splitPixel(self, data, nbPt2Th, nbPtChi=360, filename=None, correctSolidAngle=True,
                         tthRange=None, chiRange=None, mask=None, dummy=None, delta_dummy=None):
        """
        Calculate the 2D powder diffraction pattern (2Theta,Chi) from a set of data, an image
        
        Split pixels according to their corner positions
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt2Th: number of points in the output pattern in the Radial (horizontal) axis (2 theta)
        @type nbPt: integer
        @param nbPtChi: number of points in the output pattern along the Azimuthal (vertical) axis (chi) 
        @type nbPtChi: integer
        @param filename: file to save data in
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param tthRange: The lower and upper range of the 2theta. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type tthRange: (float, float), optional
        @param chiRange: The lower and upper range of the azimuthal angle. If not provided, range is simply (data.min(), data.max()).
                        Values outside the range are ignored. 
        @type chiRange: (float, float), optional
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
        @rtype: 3-tuple of ndarrays
        """
        try:
            import splitPixel#IGNORE:F0401
        except ImportError as error:
            logger.error("Import error %s , falling back on SplitBBox !" % error)
            return self.xrpd2_splitBBox(data=data, nbPt2Th=nbPt2Th, nbPtChi=nbPtChi,
                                        filename=filename, correctSolidAngle=correctSolidAngle,
                                        tthRange=tthRange, chiRange=chiRange, mask=mask, dummy=dummy, delta_dummy=delta_dummy)
        mask = self.makeMask(data, mask, dummy, delta_dummy)
        pos = self.cornerArray(data.shape)[mask]
        if tthRange is not None:
            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
        if chiRange is not None:
            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])

        if correctSolidAngle:
            data = (data / self.solidAngleArray(data.shape))[mask]
        else:
            data = data[mask]
        if dummy is None:
            dummy = 0
        I, bins2Th, binsChi, a, b = splitPixel.fullSplit2D(pos=pos,
                                                           weights=data,
                                                           bins=(nbPt2Th, nbPtChi),
                                                           pos0Range=tthRange,
                                                           pos1Range=chiRange,
                                                           dummy=dummy)
        bins2Th = numpy.degrees(bins2Th)
        binsChi = numpy.degrees(binsChi)
        if filename:
            self.save2D(filename, I, bins2Th, binsChi)
        return I, bins2Th, binsChi
    xrpd2 = xrpd2_splitBBox




    def save2D(self, filename, I, dim1, dim2, dim1_unit="2th"):
        header = {"dist":str(self._dist),
                  "poni1": str(self._poni1),
                  "poni2": str(self._poni2),
                  "rot1": str(self._rot1),
                  "rot2": str(self._rot2),
                  "rot3": str(self._rot3),
                  "chi_min":str(dim2.min()),
                  "chi_max":str(dim2.max()),
                  dim1_unit + "_min":str(dim1.min()),
                  dim1_unit + "_max":str(dim1.max()),
                  "pixelX": str(self.pixel2), #this is not a bug ... most people expect dim1 to be X
                  "pixelY": str(self.pixel1), #this is not a bug ... most people expect dim2 to be Y
                }
        if self.splineFile:
            header["spline"] = str(self.splineFile)
        f2d = self.getFit2D()
        for key in f2d:
            header["key"] = f2d[key]
        try:
            fabio.edfimage.edfimage(data=I.astype("float32"), header=header).write(filename)
        except IOError:
            logger.error("IOError while writing %s" % filename)



    def saxs(self, data, nbPt, filename=None, correctSolidAngle=True,
                   variance=None, mask=None, dummy=None, delta_dummy=None, method="bbox"):
        """
        Calculate the azimuthal integrated Saxs curve  
        
        Multi algorithm implementation (tries to be bullet proof)
        
        @param data: 2D array from the CCD camera
        @type data: ndarray
        @param nbPt: number of points in the output pattern
        @type nbPt: integer
        @param filename: file to save data to
        @type filename: string
        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
        @type correctSolidAngle: boolean
        @param variance: array containing the variance of the data
        @type variance: ndarray
        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
        @param  dummy: value for dead/masked pixels 
        @param delta_dummy: precision for dummy value
        @param method: can be "numpy", "cython", "BBox" or "splitpixel" 
        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
        @rtype: 3-tuple of ndarrays
        """
        method = method.lower()
        if variance is not None:
            assert variance.shape == data.shape
        mask = self.makeMask(data, mask)
        shape = data.shape
        data = data.astype("float32")
        q = self.qArray(shape)
        if self.darkcurrent is not None:
            if os.path.isfile(self.darkcurrent):
                dcf = os.path.abspath(self.darkcurrent)
                if dcf not  in self._darkcurrents:
                    self._darkcurrents[dcf] = fabio.open(dcf).data.astype("float32")
                data -= self._darkcurrents[dcf]
                mask = mask * (data >= 0) #invalidate data < dark current
        if self.flatfield is not None:
            if os.path.isfile(self.flatfield):
                fff = os.path.abspath(self.flatfield)
                if fff not  in self._flatfields:
                    self._flatfields[fff] = fabio.open(fff).data.astype("float32")
                data /= self._flatfields[fff]
                mask = mask * (self._flatfields[fff] > 0) #invalidate flatfield <=0
        if self.background is not None:
            if os.path.isfile(self.background):
                bgf = os.path.abspath(self.background)
                if bgf not  in self._backgrounds:
                    self._backgrounds[bgf] = fabio.open(bgf).data.astype("float32")
                data -= self._backgrounds[bgf]
                mask = mask * (data >= 0) #invalidate data < background

        if correctSolidAngle:
            data = (data / self.solidAngleArray(shape))
        I = None
        sigma = None
        if method.lower() == "splitpixel":
            logger.debug("saxs uses SplitPixel implementation")
            try:
                import splitPixel#IGNORE:F0401
            except ImportError as error:
                logger.error("Import error %s , falling back on splitbbox histogram !" % error)
                method = "bbox"
            else:
                pos = self.cornerQArray(shape)
                data = data[mask]
                pos = pos[mask]
                if variance is not None:
                    variance = variance[mask]
                qAxis, I, a, b = splitPixel.fullSplit1D(pos=pos,
                                                        weights=data,
                                                        bins=nbPt,
                                                        dummy=dummy,
                                                        delta_dummy=delta_dummy)
                if variance is not None:
                    qa, var1d, a, b = splitPixel.fullSplit1D(pos=pos,
                                                            weights=variance,
                                                            bins=nbPt,
                                                            dummy=dummy,
                                                            delta_dummy=delta_dummy)
                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)

        if method.lower() == "bbox":
            logger.debug("saxs uses BBox implementation")
            try:
                import splitBBox#IGNORE:F0401
            except ImportError as error:
                logger.error("Import error %s , falling back on Cython histogram !" % error)
                method = "cython"
            else:
                mask = self.makeMask(data, mask, dummy, delta_dummy)
                dq = self.deltaQ(shape)[mask]
                q = q[mask]
                if variance is not None:
                    variance = variance[mask]
                data = data[mask]
                if dummy is None:
                    dummy = 0
                qAxis, I, a, b = splitBBox.histoBBox1d(weights=data,
                                                      pos0=q,
                                                      delta_pos0=dq,
                                                      bins=nbPt,
                                                      dummy=dummy)
                if variance is not None:
                    qa, var1d, a, b = splitBBox.histoBBox1d(weights=variance,
                                                      pos0=q,
                                                      delta_pos0=dq,
                                                      bins=nbPt,
                                                      dummy=dummy)
                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)

        if (I is None) and (method == "cython"):
            logger.debug("saxs uses cython implementation")
            try:
                import histogram#IGNORE:F0401
            except ImportError as error:
                logger.error("Import error %s , falling back on Numpy histogram !", error)
                method = "numpy"
            else:
                mask = self.makeMask(data, mask, dummy, delta_dummy)
                q = q[mask]
                if variance is not None:
                    variance = variance[mask]
                data = data[mask]
                if dummy is None:
                    dummy = 0
                qAxis, I, a, b = histogram.histogram(pos=q,
                                                   weights=data,
                                                   bins=nbPt,
                                                   pixelSize_in_Pos=1,
                                                   dummy=dummy)
                if variance is not None:
                    qa, var1d, a, b = histogram.histogram(pos=q,
                                                   weights=variance,
                                                   bins=nbPt,
                                                   pixelSize_in_Pos=1,
                                                   dummy=dummy)
                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)

        if (I is None) :
            logger.debug("saxs uses Numpy implementation")
            mask = self.makeMask(data, mask, dummy, delta_dummy)
            data = data[mask]
            q = q[mask]
            ref, b = numpy.histogram(q, nbPt)
            count = numpy.maximum(1, ref)
            val, b = numpy.histogram(q, nbPt, weights=data)

            if variance is not None:
                variance = variance[mask]
                var1d, b = numpy.histogram(q, nbPt, weights=variance)
                sigma = numpy.sqrt(var1d) / count
            qAxis = (b[1:] + b[:-1]) / 2.0
            I = val / count

        if filename:
            with open(filename, "w") as f:
                f.write(self.makeHeaders())
                f.write("# --> %s%s" % (filename, os.linesep))
                if variance is None:
                    f.write("#%14s %14s %s" % ("q_nm^-1 ", "I ", os.linesep))
                    for t, i in zip(qAxis, I):
                        f.write("%14.6e  %14.6e %s" % (t, i, os.linesep))
                else:
                    f.write("#%14s  %14s  %14s%s" % ("q_nm^-1 ", "I ", "sigma ", os.linesep))
                    for t, i, s in zip(qAxis, I, sigma):
                        f.write("%14.6e  %14.6e  %14.6e %s" % (t, i, s, os.linesep))
        return qAxis, I, sigma

#    def saxs_numpy(self, data, nbPt, filename=None, correctSolidAngle=True,
#                   variance=None, mask=None, dummy=None, delta_dummy=None):
#        """
#        Calculate the azimuthal integrated Saxs curve  
#        
#        Numpy Implementation (bullet proof)
#        
#        @param data: 2D array from the CCD camera
#        @type data: ndarray
#        @param nbPt: number of points in the output pattern
#        @type nbPt: integer
#        @param filename: file to save data to
#        @type filename: string
#        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
#        @type correctSolidAngle: boolean
#        @param variance: array containing the variance of the data
#        @type variance: ndarray
#        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
#        @param  dummy: value for dead/masked pixels 
#        @param delta_dummy: precision for dummy value
#        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
#        @rtype: 3-tuple of ndarrays
#        """
#        mask = self.makeMask(data, mask, dummy, delta_dummy)
#        shape = data.shape
#        q = self.qArray(shape)[mask]
#        if correctSolidAngle:
#            data = (data / self.solidAngleArray(shape))[mask]
#        else:
#            data = data[mask]
#        if dummy is None:
#            dummy = 0.0
#
#        if nbPt not in self._nbPixCache:
#            ref, b = numpy.histogram(q, nbPt)
#            self._nbPixCache[nbPt] = numpy.maximum(1, ref)
#        val, b = numpy.histogram(q, nbPt, weights=data)
#
#        if variance is not None:
#            variance = variance[mask]
#            var1d, b = numpy.histogram(q, nbPt, weights=variance)
#            sigma = numpy.sqrt(var1d) / numpy.maximum(1, self._nbPixCache[nbPt])
#
##            var1d /= numpy.maximum(self._nbPixCache[nbPt], 1)
#        qAxis = (b[1:] + b[:-1]) / 2.0
#        I = val / self._nbPixCache[nbPt]
#        if filename:
#            if variance is  None:
#                out = ["%14.6e  %14.6e %s" % (t, i, os.linesep) for t, i in zip(qAxis, I)]
#            else:
#                out = ["%14.6e  %14.6e  %14.6e %s" % (t, i, s, os.linesep) for t, i, s in zip(qAxis, I, sigma)]
#            open(filename, "w").writelines(out)
#        if variance is None:
#            return qAxis, I
#        else:
#            return qAxis, I, sigma
#
#
#    def saxs_cython(self, data, nbPt, filename=None, correctSolidAngle=True,
#                   variance=None, mask=None, dummy=None, delta_dummy=None):
#        """
#        Calculate the azimuthal integrated Saxs curve  
#        
#        Cython implementation (faster)
#        
#        @param data: 2D array from the CCD camera
#        @type data: ndarray
#        @param nbPt: number of points in the output pattern
#        @type nbPt: integer
#        @param filename: file to save data to
#        @type filename: string
#        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
#        @type correctSolidAngle: boolean
#        @param variance: array containing the variance of the data
#        @type variance: ndarray
#        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
#        @param  dummy: value for dead/masked pixels 
#        @param delta_dummy: precision for dummy value
#        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
#        @rtype: 3-tuple of ndarrays
#        """
#        try:
#            import histogram#IGNORE:F0401
#        except ImportError as error:
#            logger.error("Import error %s , falling back on Numpy histogram !" % error)
#            return self.saxs_numpy(data=data, nbPt=nbPt, filename=filename, correctSolidAngle=correctSolidAngle,
#                                   variance=variance, dummy=dummy, delta_dummy=delta_dummy)
#        mask = self.makeMask(data, mask, dummy, delta_dummy)
#        shape = data.shape
#        q = self.qArray(shape)[mask]
#        if variance is not None:
#            variance = variance[mask]
#        if correctSolidAngle:
#            data = (data / self.solidAngleArray(shape))[mask]
#        else:
#            data = data[mask]
#        if dummy is None:
#            dummy = 0
#        qAxis, I, a, b = histogram.histogram(pos=q,
#                                           weights=data,
#                                           bins=nbPt,
#                                           pixelSize_in_Pos=1,
#                                           dummy=dummy)
#
#        if variance is not None:
#            qa, var1d, a, b = histogram.histogram(pos=q,
#                                           weights=variance,
#                                           bins=nbPt,
#                                           pixelSize_in_Pos=1,
#                                           dummy=dummy)
#            sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
#        if filename:
#            if variance is  None:
#                out = ["%14.6e  %14.6e %s" % (t, i, os.linesep) for t, i in zip(qAxis, I)]
#            else:
#                out = ["%14.6e  %14.6e  %14.6e %s" % (t, i, s, os.linesep) for t, i, s in zip(qAxis, I, sigma)]
#            open(filename, "w").writelines(out)
#        if variance is None:
#            return qAxis, I
#        else:
#            return qAxis, I, sigma
#
#    def saxs_splitBBox(self, data, nbPt, filename=None, correctSolidAngle=True,
#                   variance=None, mask=None, dummy=None, delta_dummy=None):
#        """
#        Calculate the azimuthal integrated Saxs curve  
#        
#        Cython implementation splitting pixel on their BBox
#        
#        @param data: 2D array from the CCD camera
#        @type data: ndarray
#        @param nbPt: number of points in the output pattern
#        @type nbPt: integer
#        @param filename: file to save data to
#        @type filename: string
#        @param correctSolidAngle: if True, the data are devided by the solid angle of each pixel
#        @type correctSolidAngle: boolean
#        @param variance: array containing the variance of the data
#        @type variance: ndarray
#        @param mask: array (same siza as image) with 0 for masked pixels, and 1 for valid pixels
#        @param  dummy: value for dead/masked pixels 
#        @param delta_dummy: precision for dummy value
#        @return: azimuthaly regrouped data, 2theta pos. and chi pos.
#        @rtype: 3-tuple of ndarrays
#        """
#        try:
#            import splitBBox#IGNORE:F0401
#        except ImportError as error:
#            logger.error("Import error %s , falling back on Numpy histogram !" % error)
#            return self.saxs_cython(data=data, nbPt=nbPt, filename=filename, correctSolidAngle=correctSolidAngle,
#                                   variance=variance, dummy=dummy, delta_dummy=delta_dummy)
#        mask = self.makeMask(data, mask, dummy, delta_dummy)
#        shape = data.shape
#        q = self.qArray(shape)[mask]
#        dq = self.deltaQ(shape)[mask]
#        if variance is not None:
#            variance = variance[mask]
#        if correctSolidAngle:
#            data = (data / self.solidAngleArray(shape))[mask]
#        else:
#            data = data[mask]
#        if dummy is None:
#            dummy = 0
#        qAxis, I, a, b = splitBBox.histoBBox1d(weights=data,
#                                              pos0=q,
#                                              delta_pos0=dq,
#                                              bins=nbPt,
#                                              dummy=dummy)
#
#        if variance is not None:
#            qa, var1d, a, b = splitBBox.histoBBox1d(weights=variance,
#                                              pos0=q,
#                                              delta_pos0=dq,
#                                              bins=nbPt,
#                                              dummy=dummy)
#            sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
#        if filename:
#            if variance is  None:
#                out = ["%14.6e  %14.6e %s" % (t, i, os.linesep) for t, i in zip(qAxis, I)]
#            else:
#                out = ["%14.6e  %14.6e  %14.6e %s" % (t, i, s, os.linesep) for t, i, s in zip(qAxis, I, sigma)]
#            open(filename, "w").writelines(out)
#        if variance is None:
#            return qAxis, I
#        else:
#            return qAxis, I, sigma
#
##    saxs = saxs_splitBBox


    def makeHeaders(self, hdr="#"):
        """
        @return: a string to be used for headers
        """
        if self.header is None:
            headerLst = ["== pyFAI calibration =="]
            headerLst.append("SplineFile: %s" % self.spline)
            headerLst.append("PixelSize: %.3e, %.3e m" % (self.pixel1, self.pixel2))
            headerLst.append("PONI: %.3e, %.3e m" % (self.poni1, self.poni2))
            headerLst.append("Distance Sample to Detector: %s m" % self.dist)
            headerLst.append("Rotations: %.6f %.6f %.6f rad" % (self.rot1, self.rot2, self.rot3))
            headerLst += ["", "== Fit2d calibration =="]
            f2d = self.getFit2D()
            headerLst.append("Distance Sample-beamCenter: %.3f mm" % f2d["DirectBeamDist"])
            headerLst.append("Center: x=%.3f, y=%.3f pix" % (f2d["BeamCenterX"], f2d["BeamCenterY"]))
            headerLst.append("Tilt: %.3f deg  TiltPlanRot: %.3f deg" % (f2d["Tilt"], f2d["TiltPlanRot"]))
            headerLst.append("")
            if self.wavelength is not None:
                headerLst.append("Wavelength: %s" % self.wavelength)
            if self.maskfile is not None:
                headerLst.append("Mask File: %s" % self.maskfile)
            if self.darkcurrent is not None:
                headerLst.append("DarkCurrent File: %s" % self.darkcurrent)
            if self.flatfield is not None:
                headerLst.append("Flatfield File: %s" % self.flatfield)
            if self.background is not None:
                headerLst.append("Background File: %s" % self.background)
            self.header = os.linesep.join([hdr + " " + i for i in headerLst])
        return self.header
pyfai-0.3.5/CHANGELOG.txt0000644001611600065110000000060011706351456014035 0ustar  kieffersoft0.1: Geometry is OK (05/2011)
0.2: Azimuthal integration using cython histogramming is working (07/2011)
0.3: Azimuthal integration splits pixels like fit2d (11/2011)
     global clean up of the code regarding options from command line and better design
     correct the orientation of the azimuthal angle chi
     rename scripts in pyFAI-calib, pyFAI-saxs and pyFAI-waxs (01/2012)