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;
}