Generated by Cython 0.19 on Thu Jul 11 09:13:37 2013

Raw output: histogram.c

     1: #!/usr/bin/env python

      /* "histogram.pyx":1
     * #!/usr/bin/env python             # <<<<<<<<<<<<<<
     * # -*- coding: utf-8 -*-
     * #
     */
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

     2: # -*- coding: utf-8 -*-

     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: __author__ = "Jerome Kieffer"

      /* "histogram.pyx":27
     * #
     *
     * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
     * __date__ = "20130711"
     *
     */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     28: __date__ = "20130711"

      /* "histogram.pyx":28
     *
     * __author__ = "Jerome Kieffer"
     * __date__ = "20130711"             # <<<<<<<<<<<<<<
     *
     * import cython
     */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s__20130711)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     29:

     30: import cython

     31: from cython.parallel cimport prange

     32: import numpy

      /* "histogram.pyx":32
     * import cython
     * from cython.parallel cimport prange
     * import numpy             # <<<<<<<<<<<<<<
     * cimport numpy
     * import sys
     */
      __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 (PyDict_SetItem(__pyx_d, __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: cimport numpy

     34: import sys

      /* "histogram.pyx":34
     * import numpy
     * cimport numpy
     * import sys             # <<<<<<<<<<<<<<
     *
     * from libc.stdlib cimport free, calloc,malloc
     */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     35:

     36: from libc.stdlib cimport free, calloc,malloc

     37: from libc.math cimport floor,fabs

     38: from openmp cimport omp_set_num_threads, omp_get_max_threads, omp_get_thread_num

     39: EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)

      /* "histogram.pyx":39
     * from libc.math cimport floor,fabs
     * from openmp cimport omp_set_num_threads, omp_get_max_threads, omp_get_thread_num
     * EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
     *
     * @cython.cdivision(True)
     */
      __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__finfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__eps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__EPS32, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     40:

     41: @cython.cdivision(True)

     42: @cython.boundscheck(False)

     43: @cython.wraparound(False)

     44: def histogram(numpy.ndarray pos not None, \

    /* "histogram.pyx":44
     * @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(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, PyArrayObject *__pyx_v_weights, long __pyx_v_bins, PyObject *__pyx_v_bin_range, PyObject *__pyx_v_pixelSize_in_Pos, PyObject *__pyx_v_nthread, double __pyx_v_dummy) {
      CYTHON_UNUSED long __pyx_v_size;
      __Pyx_memviewslice __pyx_v_cpos = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyArrayObject *__pyx_v_outData = 0;
      PyArrayObject *__pyx_v_outCount = 0;
      PyArrayObject *__pyx_v_outMerge = 0;
      PyArrayObject *__pyx_v_outPos = 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;
      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;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
      __Pyx_Buffer __pyx_pybuffer_outCount;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
      __Pyx_Buffer __pyx_pybuffer_outData;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
      __Pyx_Buffer __pyx_pybuffer_outMerge;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outPos;
      __Pyx_Buffer __pyx_pybuffer_outPos;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("histogram", 0);
      __pyx_pybuffer_outData.pybuffer.buf = NULL;
      __pyx_pybuffer_outData.refcount = 0;
      __pyx_pybuffernd_outData.data = NULL;
      __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData;
      __pyx_pybuffer_outCount.pybuffer.buf = NULL;
      __pyx_pybuffer_outCount.refcount = 0;
      __pyx_pybuffernd_outCount.data = NULL;
      __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount;
      __pyx_pybuffer_outMerge.pybuffer.buf = NULL;
      __pyx_pybuffer_outMerge.refcount = 0;
      __pyx_pybuffernd_outMerge.data = NULL;
      __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
      __pyx_pybuffer_outPos.pybuffer.buf = NULL;
      __pyx_pybuffer_outPos.refcount = 0;
      __pyx_pybuffernd_outPos.data = NULL;
      __pyx_pybuffernd_outPos.rcbuffer = &__pyx_pybuffer_outPos;

      /* "histogram.pyx":44
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def histogram(numpy.ndarray pos not None, \             # <<<<<<<<<<<<<<
     *               numpy.ndarray weights not None, \
     *               long bins=100,
     */
      __pyx_k_tuple_49 = PyTuple_Pack(38, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__bin_range), ((PyObject *)__pyx_n_s__pixelSize_in_Pos), ((PyObject *)__pyx_n_s__nthread), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__cpos), ((PyObject *)__pyx_n_s__cdata), ((PyObject *)__pyx_n_s__outData), ((PyObject *)__pyx_n_s__outCount), ((PyObject *)__pyx_n_s__outMerge), ((PyObject *)__pyx_n_s__outPos), ((PyObject *)__pyx_n_s__bin_edge_min), ((PyObject *)__pyx_n_s__bin_edge_max), ((PyObject *)__pyx_n_s__bin_width), ((PyObject *)__pyx_n_s__inv_bin_width), ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__d), ((PyObject *)__pyx_n_s__fbin), ((PyObject *)__pyx_n_s__ffbin), ((PyObject *)__pyx_n_s__dInt), ((PyObject *)__pyx_n_s__dIntR), ((PyObject *)__pyx_n_s__dIntL), ((PyObject *)__pyx_n_s__dtmp), ((PyObject *)__pyx_n_s__dbin), ((PyObject *)__pyx_n_s__inv_dbin2), ((PyObject *)__pyx_n_s__tmp_count), ((PyObject *)__pyx_n_s__tmp_data), ((PyObject *)__pyx_n_s__epsilon), ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__t), ((PyObject *)__pyx_n_s__dest), ((PyObject *)__pyx_n_s__bigCount), ((PyObject *)__pyx_n_s__bigData)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_49);
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));

      /* "histogram.pyx":44
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def histogram(numpy.ndarray pos not None, \             # <<<<<<<<<<<<<<
     *               numpy.ndarray weights not None, \
     *               long bins=100,
     */
      __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_9histogram_1histogram, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__histogram, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(7, 0, 38, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_51, __pyx_n_s__histogram, 44, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     45:               numpy.ndarray weights not None, \

     46:               long bins=100,

     47:               bin_range=None,

        /* "histogram.pyx":47
     *               numpy.ndarray weights not None, \
     *               long bins=100,
     *               bin_range=None,             # <<<<<<<<<<<<<<
     *               pixelSize_in_Pos=None,
     *               nthread=None,
     */
        values[3] = ((PyObject *)Py_None);

     48:               pixelSize_in_Pos=None,

        /* "histogram.pyx":48
     *               long bins=100,
     *               bin_range=None,
     *               pixelSize_in_Pos=None,             # <<<<<<<<<<<<<<
     *               nthread=None,
     *               double dummy=0.0):
     */
        values[4] = ((PyObject *)Py_None);

     49:               nthread=None,

        /* "histogram.pyx":49
     *               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;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_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 (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("histogram", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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, pos_args, "histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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 = 46; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        } else {

     50:               double dummy=0.0):

          /* "histogram.pyx":50
     *               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 = 44; __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:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 0, "pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_9histogram_histogram(__pyx_self, __pyx_v_pos, __pyx_v_weights, __pyx_v_bins, __pyx_v_bin_range, __pyx_v_pixelSize_in_Pos, __pyx_v_nthread, __pyx_v_dummy);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     51:     """

     52:     Calculates histogram of pos weighted by weights

     53:

     54:     @param pos: 2Theta array

     55:     @param weights: array with intensities

     56:     @param bins: number of output bins

     57:     @param pixelSize_in_Pos: size of a pixels in 2theta

     58:     @param nthread: maximum number of thread to use. By default: maximum available.

     59:         One can also limit this with OMP_NUM_THREADS environment variable

     60:

     61:     @return 2theta, I, weighted histogram, raw histogram

     62:     """

     63:

     64:     assert pos.size == weights.size

      /* "histogram.pyx":64
     *     """
     *
     *     assert pos.size == weights.size             # <<<<<<<<<<<<<<
     *     assert  bins > 1
     *     cdef long  size = pos.size
     */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     65:     assert  bins > 1

      /* "histogram.pyx":65
     *
     *     assert pos.size == weights.size
     *     assert  bins > 1             # <<<<<<<<<<<<<<
     *     cdef long  size = pos.size
     *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)
     */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!(__pyx_v_bins > 1))) {
        PyErr_SetNone(PyExc_AssertionError);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     66:     cdef long  size = pos.size

      /* "histogram.pyx":66
     *     assert pos.size == weights.size
     *     assert  bins > 1
     *     cdef long  size = pos.size             # <<<<<<<<<<<<<<
     *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)
     *     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_5;

     67:     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)

      /* "histogram.pyx":67
     *     assert  bins > 1
     *     cdef long  size = pos.size
     *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)             # <<<<<<<<<<<<<<
     *     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __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_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7);
      if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_cpos = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     68:     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)

      /* "histogram.pyx":68
     *     cdef long  size = pos.size
     *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)
     *     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
     */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6);
      if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_cdata = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     69:     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")

      /* "histogram.pyx":69
     *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)
     *     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
     */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); 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);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_10 = 0;
      __pyx_v_outData = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     70:     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")

      /* "histogram.pyx":70
     *     cdef double[:] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
     */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __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_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_11 = 0;
      __pyx_v_outCount = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

     71:     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")

      /* "histogram.pyx":71
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
     *     cdef double bin_edge_min, bin_edge_max
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 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 = 71; __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_12 = 0;
      __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     72:     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")

      /* "histogram.pyx":72
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef double bin_edge_min, bin_edge_max
     *     if bin_range is not None:
     */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_outPos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outPos.diminfo[0].strides = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outPos.diminfo[0].shape = __pyx_pybuffernd_outPos.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_13 = 0;
      __pyx_v_outPos = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     73:     cdef double bin_edge_min, bin_edge_max

     74:     if bin_range is not None:

      /* "histogram.pyx":74
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outPos = numpy.zeros(bins, dtype="float64")
     *     cdef double bin_edge_min, bin_edge_max
     *     if bin_range is not None:             # <<<<<<<<<<<<<<
     *         bin_edge_min = bin_range[0]
     *         bin_edge_max = bin_range[1] * EPS32
     */
      __pyx_t_4 = (__pyx_v_bin_range != Py_None);
      if (__pyx_t_4) {

     75:         bin_edge_min = bin_range[0]

        /* "histogram.pyx":75
     *     cdef double bin_edge_min, bin_edge_max
     *     if bin_range is not None:
     *         bin_edge_min = bin_range[0]             # <<<<<<<<<<<<<<
     *         bin_edge_max = bin_range[1] * EPS32
     *     else:
     */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bin_range, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_bin_edge_min = __pyx_t_14;

     76:         bin_edge_max = bin_range[1] * EPS32

        /* "histogram.pyx":76
     *     if bin_range is not None:
     *         bin_edge_min = bin_range[0]
     *         bin_edge_max = bin_range[1] * EPS32             # <<<<<<<<<<<<<<
     *     else:
     *         bin_edge_min = pos.min()
     */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bin_range, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_bin_edge_max = __pyx_t_14;
        goto __pyx_L3;
      }
      /*else*/ {

     77:     else:

     78:         bin_edge_min = pos.min()

        /* "histogram.pyx":78
     *         bin_edge_max = bin_range[1] * EPS32
     *     else:
     *         bin_edge_min = pos.min()             # <<<<<<<<<<<<<<
     *         bin_edge_max = pos.max() * EPS32
     *     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))
     */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_bin_edge_min = __pyx_t_14;

     79:         bin_edge_max = pos.max() * EPS32

        /* "histogram.pyx":79
     *     else:
     *         bin_edge_min = pos.min()
     *         bin_edge_max = pos.max() * EPS32             # <<<<<<<<<<<<<<
     *     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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__max); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_bin_edge_max = __pyx_t_14;
      }
      __pyx_L3:;

     80:     cdef double bin_width = (bin_edge_max - bin_edge_min) / (< double > (bins))

      /* "histogram.pyx":80
     *         bin_edge_min = pos.min()
     *         bin_edge_max = pos.max() * EPS32
     *     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));

     81:     cdef double inv_bin_width = (< double > (bins)) / (bin_edge_max - bin_edge_min)

      /* "histogram.pyx":81
     *         bin_edge_max = pos.max() * EPS32
     *     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));

     82:     cdef double a = 0.0

      /* "histogram.pyx":82
     *     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;

     83:     cdef double d = 0.0

      /* "histogram.pyx":83
     *     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;

     84:     cdef double fbin = 0.0

      /* "histogram.pyx":84
     *     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;

     85:     cdef double ffbin = 0.0

      /* "histogram.pyx":85
     *     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;

     86:     cdef double dInt = 0.0

      /* "histogram.pyx":86
     *     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;

     87:     cdef double dIntR = 0.0

      /* "histogram.pyx":87
     *     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;

     88:     cdef double dIntL = 0.0

      /* "histogram.pyx":88
     *     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;

     89:     cdef double dtmp = 0.0

      /* "histogram.pyx":89
     *     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;

     90:     cdef double dbin, inv_dbin2 = 0.0

      /* "histogram.pyx":90
     *     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;

     91:     cdef double tmp_count, tmp_data = 0.0

      /* "histogram.pyx":91
     *     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;

     92:     cdef double epsilon = 1e-10

      /* "histogram.pyx":92
     *     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;

     93:

     94:     cdef long   bin = 0

      /* "histogram.pyx":94
     *     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;

     95:     cdef long   i, idx, t, dest = 0

      /* "histogram.pyx":95
     *
     *     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;

     96:     if nthread is not None:

      /* "histogram.pyx":96
     *     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) {

     97:         if isinstance(nthread, int) and (nthread > 0):

        /* "histogram.pyx":97
     *     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)
     *     #multi-threaded version of this algorithm fails on MacOSX
     */
        __pyx_t_4 = PyInt_Check(__pyx_v_nthread);
        if (__pyx_t_4) {
          __pyx_t_1 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_16 = __pyx_t_15;
        } else {
          __pyx_t_16 = __pyx_t_4;
        }
        if (__pyx_t_16) {

     98:             omp_set_num_threads(< int > nthread)

          /* "histogram.pyx":98
     *     if nthread is not None:
     *         if isinstance(nthread, int) and (nthread > 0):
     *             omp_set_num_threads(< int > nthread)             # <<<<<<<<<<<<<<
     *     #multi-threaded version of this algorithm fails on MacOSX
     *     if sys.platform == "darwin":
     */
          __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          omp_set_num_threads(((int)__pyx_t_17));
          goto __pyx_L5;
        }
        __pyx_L5:;
        goto __pyx_L4;
      }
      __pyx_L4:;

     99:     #multi-threaded version of this algorithm fails on MacOSX

     100:     if sys.platform == "darwin":

      /* "histogram.pyx":100
     *             omp_set_num_threads(< int > nthread)
     *     #multi-threaded version of this algorithm fails on MacOSX
     *     if sys.platform == "darwin":             # <<<<<<<<<<<<<<
     *          omp_set_num_threads(< int > 1)
     *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
     */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); 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_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__platform); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__darwin), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_16) {

     101:          omp_set_num_threads(< int > 1)

        /* "histogram.pyx":101
     *     #multi-threaded version of this algorithm fails on MacOSX
     *     if sys.platform == "darwin":
     *          omp_set_num_threads(< int > 1)             # <<<<<<<<<<<<<<
     *     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
     *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
     */
        omp_set_num_threads(((int)1));
        goto __pyx_L6;
      }
      __pyx_L6:;

     102:     cdef double * bigCount = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))

      /* "histogram.pyx":102
     *     if sys.platform == "darwin":
     *          omp_set_num_threads(< int > 1)
     *     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))));

     103:     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))

      /* "histogram.pyx":103
     *          omp_set_num_threads(< int > 1)
     *     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))));

     104:     if pixelSize_in_Pos is None:

      /* "histogram.pyx":104
     *     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) {

     105:         dbin = 0.5

        /* "histogram.pyx":105
     *     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;

     106:         inv_dbin2 = 4.0

        /* "histogram.pyx":106
     *     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_L7;
      }

     107:     elif isinstance(pixelSize_in_Pos, (int, float)):

      /* "histogram.pyx":107
     *         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_1 = __pyx_v_pixelSize_in_Pos;
      __pyx_t_16 = PyInt_Check(__pyx_t_1);
      if (!__pyx_t_16) {
        __pyx_t_4 = PyFloat_Check(__pyx_t_1);
        __pyx_t_15 = __pyx_t_4;
      } else {
        __pyx_t_15 = __pyx_t_16;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_15) {

     108:         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width

        /* "histogram.pyx":108
     *         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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_dbin = ((0.5 * ((double)__pyx_t_14)) * __pyx_v_inv_bin_width);

     109:         if dbin > 0.0:

        /* "histogram.pyx":109
     *     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) {

     110:             inv_dbin2 = 1 / dbin / dbin

          /* "histogram.pyx":110
     *         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_L8;
        }
        /*else*/ {

     111:         else:

     112:             inv_dbin2 = 0.0

          /* "histogram.pyx":112
     *             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_L8:;
        goto __pyx_L7;
      }

     113:     elif isinstance(pixelSize_in_Pos, numpy.ndarray):

      /* "histogram.pyx":113
     *         else:
     *             inv_dbin2 = 0.0
     *     elif isinstance(pixelSize_in_Pos, numpy.ndarray):             # <<<<<<<<<<<<<<
     *         pass #TODO
     *
     */
      __pyx_t_15 = __Pyx_TypeCheck(__pyx_v_pixelSize_in_Pos, ((PyObject*)__pyx_ptype_5numpy_ndarray));
      if (__pyx_t_15) {
        goto __pyx_L7;
      }
      __pyx_L7:;

     114:         pass #TODO

     115:

     116:     if numpy.isnan(dbin) or numpy.isnan(inv_dbin2):

      /* "histogram.pyx":116
     *         pass #TODO
     *
     *     if numpy.isnan(dbin) or numpy.isnan(inv_dbin2):             # <<<<<<<<<<<<<<
     *         dbin = 0.0
     *         inv_dbin2 = 0.0
     */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isnan); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dbin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!__pyx_t_15) {
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isnan); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_inv_dbin2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_4 = __pyx_t_16;
      } else {
        __pyx_t_4 = __pyx_t_15;
      }
      if (__pyx_t_4) {

     117:         dbin = 0.0

        /* "histogram.pyx":117
     *
     *     if numpy.isnan(dbin) or numpy.isnan(inv_dbin2):
     *         dbin = 0.0             # <<<<<<<<<<<<<<
     *         inv_dbin2 = 0.0
     *
     */
        __pyx_v_dbin = 0.0;

     118:         inv_dbin2 = 0.0

        /* "histogram.pyx":118
     *     if numpy.isnan(dbin) or numpy.isnan(inv_dbin2):
     *         dbin = 0.0
     *         inv_dbin2 = 0.0             # <<<<<<<<<<<<<<
     *
     *     with nogil:
     */
        __pyx_v_inv_dbin2 = 0.0;
        goto __pyx_L9;
      }
      __pyx_L9:;

     119:

     120:     with nogil:

      /* "histogram.pyx":120
     *         inv_dbin2 = 0.0
     *
     *     with nogil:             # <<<<<<<<<<<<<<
     *         for i in prange(size):
     *             d = cdata[i]
     */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

          /* "histogram.pyx":120
     *         inv_dbin2 = 0.0
     *
     *     with nogil:             # <<<<<<<<<<<<<<
     *         for i in prange(size):
     *             d = cdata[i]
     */
          /*finally:*/ {
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
          }
      }

     121:         for i in prange(size):

            /* "histogram.pyx":121
     *
     *     with nogil:
     *         for i in prange(size):             # <<<<<<<<<<<<<<
     *             d = cdata[i]
     *             a = cpos[i]
     */
            __pyx_t_5 = __pyx_v_size;
            if (1 == 0) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_19 = (__pyx_t_5 - 0) / 1;
                if (__pyx_t_19 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_a) lastprivate(__pyx_v_dtmp) lastprivate(__pyx_v_ffbin) lastprivate(__pyx_v_fbin) lastprivate(__pyx_v_bin) lastprivate(__pyx_v_dIntR) lastprivate(__pyx_v_d) lastprivate(__pyx_v_dInt) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_dest) lastprivate(__pyx_v_dIntL)
                        #endif /* _OPENMP */
                        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++){
                            {
                                __pyx_v_i = 0 + 1 * __pyx_t_18;
                                /* Initialize private variables to invalid values */
                                __pyx_v_a = ((double)__PYX_NAN());
                                __pyx_v_dtmp = ((double)__PYX_NAN());
                                __pyx_v_ffbin = ((double)__PYX_NAN());
                                __pyx_v_fbin = ((double)__PYX_NAN());
                                __pyx_v_bin = ((long)0xbad0bad0);
                                __pyx_v_dIntR = ((double)__PYX_NAN());
                                __pyx_v_d = ((double)__PYX_NAN());
                                __pyx_v_dInt = ((double)__PYX_NAN());
                                __pyx_v_dest = ((long)0xbad0bad0);
                                __pyx_v_dIntL = ((double)__PYX_NAN());

     122:             d = cdata[i]

                                /* "histogram.pyx":122
     *     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_20 = __pyx_v_i;
                                __pyx_v_d = (*((double *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_20 * __pyx_v_cdata.strides[0]) )));

     123:             a = cpos[i]

                                /* "histogram.pyx":123
     *         for i in prange(size):
     *             d = cdata[i]
     *             a = cpos[i]             # <<<<<<<<<<<<<<
     *             if (a < bin_edge_min) or (a > bin_edge_max):
     *                 continue
     */
                                __pyx_t_21 = __pyx_v_i;
                                __pyx_v_a = (*((double *) ( /* dim=0 */ (__pyx_v_cpos.data + __pyx_t_21 * __pyx_v_cpos.strides[0]) )));

     124:             if (a < bin_edge_min) or (a > bin_edge_max):

                                /* "histogram.pyx":124
     *             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_4 = (__pyx_v_a < __pyx_v_bin_edge_min);
                                if (!__pyx_t_4) {
                                  __pyx_t_15 = (__pyx_v_a > __pyx_v_bin_edge_max);
                                  __pyx_t_16 = __pyx_t_15;
                                } else {
                                  __pyx_t_16 = __pyx_t_4;
                                }
                                if (__pyx_t_16) {

     125:                 continue

                                  /* "histogram.pyx":125
     *             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_L13_continue;
                                  goto __pyx_L17;
                                }
                                __pyx_L17:;

     126:             fbin = (a - bin_edge_min) * inv_bin_width

                                /* "histogram.pyx":126
     *             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);

     127:             ffbin = floor(fbin)

                                /* "histogram.pyx":127
     *                 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);

     128:             bin = < long > ffbin

                                /* "histogram.pyx":128
     *             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);

     129:             dest = omp_get_thread_num() * bins + bin

                                /* "histogram.pyx":129
     *             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);

     130:             dInt = 1.0

                                /* "histogram.pyx":130
     *             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;

     131:             if  bin > 0 :

                                /* "histogram.pyx":131
     *             dest = omp_get_thread_num() * bins + bin
     *             dInt = 1.0
     *             if  bin > 0 :             # <<<<<<<<<<<<<<
     *                 dtmp = ffbin - (fbin - dbin)
     *                 if dtmp > 0:
     */
                                __pyx_t_16 = (__pyx_v_bin > 0);
                                if (__pyx_t_16) {

     132:                 dtmp = ffbin - (fbin - dbin)

                                  /* "histogram.pyx":132
     *             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));

     133:                 if dtmp > 0:

                                  /* "histogram.pyx":133
     *             if  bin > 0 :
     *                 dtmp = ffbin - (fbin - dbin)
     *                 if dtmp > 0:             # <<<<<<<<<<<<<<
     *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
     *                     dInt = dInt - dIntL
     */
                                  __pyx_t_16 = (__pyx_v_dtmp > 0.0);
                                  if (__pyx_t_16) {

     134:                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2

                                    /* "histogram.pyx":134
     *                 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);

     135:                     dInt = dInt - dIntL

                                    /* "histogram.pyx":135
     *                 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);

     136:                     bigCount[dest - 1] += dIntL

                                    /* "histogram.pyx":136
     *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
     *                     dInt = dInt - dIntL
     *                     bigCount[dest - 1] += dIntL             # <<<<<<<<<<<<<<
     *                     bigData[dest - 1] += d * dIntL
     *
     */
                                    __pyx_t_22 = (__pyx_v_dest - 1);
                                    (__pyx_v_bigCount[__pyx_t_22]) = ((__pyx_v_bigCount[__pyx_t_22]) + __pyx_v_dIntL);

     137:                     bigData[dest - 1] += d * dIntL

                                    /* "histogram.pyx":137
     *                     dInt = dInt - dIntL
     *                     bigCount[dest - 1] += dIntL
     *                     bigData[dest - 1] += d * dIntL             # <<<<<<<<<<<<<<
     *
     *             if bin < bins - 1 :
     */
                                    __pyx_t_22 = (__pyx_v_dest - 1);
                                    (__pyx_v_bigData[__pyx_t_22]) = ((__pyx_v_bigData[__pyx_t_22]) + (__pyx_v_d * __pyx_v_dIntL));
                                    goto __pyx_L19;
                                  }
                                  __pyx_L19:;
                                  goto __pyx_L18;
                                }
                                __pyx_L18:;

     138:

     139:             if bin < bins - 1 :

                                /* "histogram.pyx":139
     *                     bigData[dest - 1] += d * dIntL
     *
     *             if bin < bins - 1 :             # <<<<<<<<<<<<<<
     *                 dtmp = fbin + dbin - ffbin - 1
     *                 if dtmp > 0 :
     */
                                __pyx_t_16 = (__pyx_v_bin < (__pyx_v_bins - 1));
                                if (__pyx_t_16) {

     140:                 dtmp = fbin + dbin - ffbin - 1

                                  /* "histogram.pyx":140
     *
     *             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);

     141:                 if dtmp > 0 :

                                  /* "histogram.pyx":141
     *             if bin < bins - 1 :
     *                 dtmp = fbin + dbin - ffbin - 1
     *                 if dtmp > 0 :             # <<<<<<<<<<<<<<
     *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
     *                     dInt = dInt - dIntR
     */
                                  __pyx_t_16 = (__pyx_v_dtmp > 0.0);
                                  if (__pyx_t_16) {

     142:                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2

                                    /* "histogram.pyx":142
     *                 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);

     143:                     dInt = dInt - dIntR

                                    /* "histogram.pyx":143
     *                 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);

     144:                     bigCount[dest + 1] += dIntR

                                    /* "histogram.pyx":144
     *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
     *                     dInt = dInt - dIntR
     *                     bigCount[dest + 1] += dIntR             # <<<<<<<<<<<<<<
     *                     bigData[dest + 1] += d * dIntR
     *             bigCount[dest] += dInt
     */
                                    __pyx_t_22 = (__pyx_v_dest + 1);
                                    (__pyx_v_bigCount[__pyx_t_22]) = ((__pyx_v_bigCount[__pyx_t_22]) + __pyx_v_dIntR);

     145:                     bigData[dest + 1] += d * dIntR

                                    /* "histogram.pyx":145
     *                     dInt = dInt - dIntR
     *                     bigCount[dest + 1] += dIntR
     *                     bigData[dest + 1] += d * dIntR             # <<<<<<<<<<<<<<
     *             bigCount[dest] += dInt
     *             bigData[dest] += d * dInt
     */
                                    __pyx_t_22 = (__pyx_v_dest + 1);
                                    (__pyx_v_bigData[__pyx_t_22]) = ((__pyx_v_bigData[__pyx_t_22]) + (__pyx_v_d * __pyx_v_dIntR));
                                    goto __pyx_L21;
                                  }
                                  __pyx_L21:;
                                  goto __pyx_L20;
                                }
                                __pyx_L20:;

     146:             bigCount[dest] += dInt

                                /* "histogram.pyx":146
     *                     bigCount[dest + 1] += dIntR
     *                     bigData[dest + 1] += d * dIntR
     *             bigCount[dest] += dInt             # <<<<<<<<<<<<<<
     *             bigData[dest] += d * dInt
     *
     */
                                __pyx_t_22 = __pyx_v_dest;
                                (__pyx_v_bigCount[__pyx_t_22]) = ((__pyx_v_bigCount[__pyx_t_22]) + __pyx_v_dInt);

     147:             bigData[dest] += d * dInt

                                /* "histogram.pyx":147
     *                     bigData[dest + 1] += d * dIntR
     *             bigCount[dest] += dInt
     *             bigData[dest] += d * dInt             # <<<<<<<<<<<<<<
     *
     *         for idx in prange(bins):
     */
                                __pyx_t_22 = __pyx_v_dest;
                                (__pyx_v_bigData[__pyx_t_22]) = ((__pyx_v_bigData[__pyx_t_22]) + (__pyx_v_d * __pyx_v_dInt));
                                goto __pyx_L23;
                                __pyx_L13_continue:;
                                goto __pyx_L23;
                                __pyx_L23:;
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif

     148:

     149:         for idx in prange(bins):

            /* "histogram.pyx":149
     *             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_19 = __pyx_v_bins;
            if (1 == 0) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_19 - 0) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for reduction(+:__pyx_v_tmp_count) reduction(+:__pyx_v_tmp_data) firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_t) lastprivate(__pyx_v_dest)
                        #endif /* _OPENMP */
                        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_5; __pyx_t_18++){
                            {
                                __pyx_v_idx = 0 + 1 * __pyx_t_18;
                                /* Initialize private variables to invalid values */
                                __pyx_v_t = ((long)0xbad0bad0);
                                __pyx_v_dest = ((long)0xbad0bad0);

     150:             outPos[idx] = bin_edge_min + (0.5 +< double > idx) * bin_width

                                /* "histogram.pyx":150
     *
     *         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_22 = __pyx_v_idx;
                                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outPos.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_outPos.diminfo[0].strides) = (__pyx_v_bin_edge_min + ((0.5 + ((double)__pyx_v_idx)) * __pyx_v_bin_width));

     151:             tmp_count = 0.0

                                /* "histogram.pyx":151
     *         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;

     152:             tmp_data = 0.0

                                /* "histogram.pyx":152
     *             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;

     153:             for t in range(omp_get_max_threads()):

                                /* "histogram.pyx":153
     *             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_23 = 0; __pyx_t_23 < __pyx_t_17; __pyx_t_23+=1) {
                                  __pyx_v_t = __pyx_t_23;

     154:                 dest = t * bins + idx

                                  /* "histogram.pyx":154
     *             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);

     155:                 tmp_count += bigCount[dest]

                                  /* "histogram.pyx":155
     *             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]));

     156:                 tmp_data += bigData[dest]

                                  /* "histogram.pyx":156
     *                 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]));
                                }

     157:             outCount[idx] += tmp_count

                                /* "histogram.pyx":157
     *                 tmp_count += bigCount[dest]
     *                 tmp_data += bigData[dest]
     *             outCount[idx] += tmp_count             # <<<<<<<<<<<<<<
     *             outData[idx] += tmp_data
     *             if outCount[idx] > epsilon:
     */
                                __pyx_t_23 = __pyx_v_idx;
                                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outCount.diminfo[0].strides) += __pyx_v_tmp_count;

     158:             outData[idx] += tmp_data

                                /* "histogram.pyx":158
     *                 tmp_data += bigData[dest]
     *             outCount[idx] += tmp_count
     *             outData[idx] += tmp_data             # <<<<<<<<<<<<<<
     *             if outCount[idx] > epsilon:
     *                 outMerge[idx] += tmp_data / tmp_count
     */
                                __pyx_t_24 = __pyx_v_idx;
                                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_outData.diminfo[0].strides) += __pyx_v_tmp_data;

     159:             if outCount[idx] > epsilon:

                                /* "histogram.pyx":159
     *             outCount[idx] += tmp_count
     *             outData[idx] += tmp_data
     *             if outCount[idx] > epsilon:             # <<<<<<<<<<<<<<
     *                 outMerge[idx] += tmp_data / tmp_count
     *             else:
     */
                                __pyx_t_25 = __pyx_v_idx;
                                __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon);
                                if (__pyx_t_16) {

     160:                 outMerge[idx] += tmp_data / tmp_count

                                  /* "histogram.pyx":160
     *             outData[idx] += tmp_data
     *             if outCount[idx] > epsilon:
     *                 outMerge[idx] += tmp_data / tmp_count             # <<<<<<<<<<<<<<
     *             else:
     *                 outMerge[idx] += dummy
     */
                                  __pyx_t_26 = __pyx_v_idx;
                                  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_outMerge.diminfo[0].strides) += (__pyx_v_tmp_data / __pyx_v_tmp_count);
                                  goto __pyx_L30;
                                }
                                /*else*/ {

     161:             else:

     162:                 outMerge[idx] += dummy

                                  /* "histogram.pyx":162
     *                 outMerge[idx] += tmp_data / tmp_count
     *             else:
     *                 outMerge[idx] += dummy             # <<<<<<<<<<<<<<
     *
     *     free(bigCount)
     */
                                  __pyx_t_27 = __pyx_v_idx;
                                  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outMerge.diminfo[0].strides) += __pyx_v_dummy;
                                }
                                __pyx_L30:;
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     163:

     164:     free(bigCount)

      /* "histogram.pyx":164
     *                 outMerge[idx] += dummy
     *
     *     free(bigCount)             # <<<<<<<<<<<<<<
     *     free(bigData)
     *     return  outPos, outMerge, outData, outCount
     */
      free(__pyx_v_bigCount);

     165:     free(bigData)

      /* "histogram.pyx":165
     *
     *     free(bigCount)
     *     free(bigData)             # <<<<<<<<<<<<<<
     *     return  outPos, outMerge, outData, outCount
     *
     */
      free(__pyx_v_bigData);

     166:     return  outPos, outMerge, outData, outCount

      /* "histogram.pyx":166
     *     free(bigCount)
     *     free(bigData)
     *     return  outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_outPos));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_outPos));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outPos));
      __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_outMerge));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
      __Pyx_INCREF(((PyObject *)__pyx_v_outData));
      PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_outData));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
      __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
      PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_outCount));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
      __pyx_r = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer);
      __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_pybuffernd_outCount.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outPos.rcbuffer->pybuffer);
      __pyx_L2:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_cpos, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
      __Pyx_XDECREF((PyObject *)__pyx_v_outData);
      __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
      __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
      __Pyx_XDECREF((PyObject *)__pyx_v_outPos);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_9histogram_3histogram2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_9histogram_2histogram2d[] = "\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_3histogram2d = {__Pyx_NAMESTR("histogram2d"), (PyCFunction)__pyx_pw_9histogram_3histogram2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9histogram_2histogram2d)};
    static PyObject *__pyx_pw_9histogram_3histogram2d(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;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("histogram2d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos0,&__pyx_n_s__pos1,&__pyx_n_s__bins,&__pyx_n_s__weights,&__pyx_n_s__split,&__pyx_n_s__nthread,&__pyx_n_s__dummy,0};
        PyObject* values[7] = {0,0,0,0,0,0,0};
        values[4] = __pyx_k_1;

     167:

     168:

     169: @cython.cdivision(True)

     170: @cython.boundscheck(False)

     171: @cython.wraparound(False)

     172: def histogram2d(numpy.ndarray pos0 not None,

    /* "histogram.pyx":172
     * @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_2histogram2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_pos1, PyObject *__pyx_v_bins, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_split, PyObject *__pyx_v_nthread, 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;
      __Pyx_memviewslice __pyx_v_cpos0 = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_cpos1 = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 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_epsilon;
      double __pyx_v_area;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edges0;
      __Pyx_Buffer __pyx_pybuffer_edges0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edges1;
      __Pyx_Buffer __pyx_pybuffer_edges1;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
      __Pyx_Buffer __pyx_pybuffer_outCount;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
      __Pyx_Buffer __pyx_pybuffer_outData;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
      __Pyx_Buffer __pyx_pybuffer_outMerge;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("histogram2d", 0);
      __pyx_pybuffer_outData.pybuffer.buf = NULL;
      __pyx_pybuffer_outData.refcount = 0;
      __pyx_pybuffernd_outData.data = NULL;
      __pyx_pybuffernd_outData.rcbuffer = &__pyx_pybuffer_outData;
      __pyx_pybuffer_outCount.pybuffer.buf = NULL;
      __pyx_pybuffer_outCount.refcount = 0;
      __pyx_pybuffernd_outCount.data = NULL;
      __pyx_pybuffernd_outCount.rcbuffer = &__pyx_pybuffer_outCount;
      __pyx_pybuffer_outMerge.pybuffer.buf = NULL;
      __pyx_pybuffer_outMerge.refcount = 0;
      __pyx_pybuffernd_outMerge.data = NULL;
      __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
      __pyx_pybuffer_edges0.pybuffer.buf = NULL;
      __pyx_pybuffer_edges0.refcount = 0;
      __pyx_pybuffernd_edges0.data = NULL;
      __pyx_pybuffernd_edges0.rcbuffer = &__pyx_pybuffer_edges0;
      __pyx_pybuffer_edges1.pybuffer.buf = NULL;
      __pyx_pybuffer_edges1.refcount = 0;
      __pyx_pybuffernd_edges1.data = NULL;
      __pyx_pybuffernd_edges1.rcbuffer = &__pyx_pybuffer_edges1;

      /* "histogram.pyx":172
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def histogram2d(numpy.ndarray pos0 not None,             # <<<<<<<<<<<<<<
     *                 numpy.ndarray pos1 not None,
     *                 bins not None,
     */
      __pyx_k_tuple_52 = PyTuple_Pack(44, ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__split), ((PyObject *)__pyx_n_s__nthread), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__bin0), ((PyObject *)__pyx_n_s__bin1), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__b0), ((PyObject *)__pyx_n_s__b1), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__csplit), ((PyObject *)__pyx_n_s__cpos0), ((PyObject *)__pyx_n_s__cpos1), ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__outData), ((PyObject *)__pyx_n_s__outCount), ((PyObject *)__pyx_n_s__outMerge), ((PyObject *)__pyx_n_s__edges0), ((PyObject *)__pyx_n_s__edges1), ((PyObject *)__pyx_n_s__min0), ((PyObject *)__pyx_n_s__max0), ((PyObject *)__pyx_n_s__min1), ((PyObject *)__pyx_n_s__max1), ((PyObject *)__pyx_n_s__idp0), ((PyObject *)__pyx_n_s__idp1), ((PyObject *)__pyx_n_s__dbin0), ((PyObject *)__pyx_n_s__dbin1), ((PyObject *)__pyx_n_s__fbin0), ((PyObject *)__pyx_n_s__fbin1), ((PyObject *)__pyx_n_s__p0), ((PyObject *)__pyx_n_s__p1), ((PyObject *)__pyx_n_s__d), ((PyObject *)__pyx_n_s__rest), ((PyObject *)__pyx_n_s__delta0l), ((PyObject *)__pyx_n_s__delta0r), ((PyObject *)__pyx_n_s__delta1l), ((PyObject *)__pyx_n_s__delta1r), ((PyObject *)__pyx_n_s__aera), ((PyObject *)__pyx_n_s__epsilon), ((PyObject *)__pyx_n_s__area)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_52);
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));

      /* "histogram.pyx":172
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def histogram2d(numpy.ndarray pos0 not None,             # <<<<<<<<<<<<<<
     *                 numpy.ndarray pos1 not None,
     *                 bins not None,
     */
      __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_9histogram_3histogram2d, NULL, __pyx_n_s__histogram); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__histogram2d, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(7, 0, 44, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_51, __pyx_n_s__histogram2d, 172, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     173:                 numpy.ndarray pos1 not None,

     174:                 bins not None,

     175:                 numpy.ndarray weights not None,

     176:                 split=True,

      /* "histogram.pyx":176
     *                 bins not None,
     *                 numpy.ndarray weights not None,
     *                 split=True,             # <<<<<<<<<<<<<<
     *                 nthread=None,
     *                 double dummy=0.0):
     */
      __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_k_1 = __pyx_t_4;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

     177:                 nthread=None,

        /* "histogram.pyx":177
     *                 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;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_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 (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("histogram2d", 0, 4, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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, pos_args, "histogram2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        } else {

     178:                 double dummy=0.0):

          /* "histogram.pyx":178
     *                 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 = 172; __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:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 173; __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 = 174; __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_9histogram_2histogram2d(__pyx_self, __pyx_v_pos0, __pyx_v_pos1, __pyx_v_bins, __pyx_v_weights, __pyx_v_split, __pyx_v_nthread, __pyx_v_dummy);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     179:     """

     180:     Calculate 2D histogram of pos0,pos1 weighted by weights

     181:

     182:     @param pos0: 2Theta array

     183:     @param pos1: Chi array

     184:     @param weights: array with intensities

     185:     @param bins: number of output bins int or 2-tuple of int

     186:     @param nthread: maximum number of thread to use. By default: maximum available.

     187:     One can also limit this with OMP_NUM_THREADS environment variable

     188:

     189:

     190:     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)

     191:     """

     192:     assert pos0.size == pos1.size

      /* "histogram.pyx":192
     *     @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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     193: #    if weights is not No:

     194:     assert pos0.size == weights.size

      /* "histogram.pyx":194
     *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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 = 194; __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     195:     cdef long  bin0, bin1, i, j, b0, b1

     196:     cdef long  size = pos0.size

      /* "histogram.pyx":196
     *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_size = __pyx_t_5;

     197:     try:

      /* "histogram.pyx":197
     *     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:*/ {

     198:         bin0, bin1 = tuple(bins)

          /* "histogram.pyx":198
     *     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 = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_v_bins);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bins);
          __Pyx_GIVEREF(__pyx_v_bins);
          __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
          if (1) {
            PyObject* sequence = __pyx_t_2;
            #if CYTHON_COMPILING_IN_CPYTHON
            Py_ssize_t size = Py_SIZE(sequence);
            #else
            Py_ssize_t size = PySequence_Size(sequence);
            #endif
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            #if CYTHON_COMPILING_IN_CPYTHON
            __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);
            #else
            __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_3);
            #endif
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else if (1) {
            __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          } else
          {
            Py_ssize_t index = -1;
            __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
            index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_1);
            index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_3);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __pyx_t_10 = NULL;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L12_unpacking_done;
            __pyx_L11_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_10 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __pyx_L12_unpacking_done:;
          }
          __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_11 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_bin0 = __pyx_t_5;
          __pyx_v_bin1 = __pyx_t_11;
        }
        __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_L10_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __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;

     199:     except:

        /* "histogram.pyx":199
     *     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 = 199; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);

     200:         bin0 = bin1 = < long > bins

          /* "histogram.pyx":200
     *         bin0, bin1 = tuple(bins)
     *     except:
     *         bin0 = bin1 = < long > bins             # <<<<<<<<<<<<<<
     *     if bin0 <= 0:
     *         bin0 = 1
     */
          __pyx_t_11 = __Pyx_PyInt_AsLong(__pyx_v_bins); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
          __pyx_v_bin0 = ((long)__pyx_t_11);
          __pyx_v_bin1 = ((long)__pyx_t_11);
          __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_L4_exception_handled;
        }
        __pyx_L5_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_L4_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_L10_try_end:;
      }

     201:     if bin0 <= 0:

      /* "histogram.pyx":201
     *     except:
     *         bin0 = bin1 = < long > bins
     *     if bin0 <= 0:             # <<<<<<<<<<<<<<
     *         bin0 = 1
     *     if bin1 <= 0:
     */
      __pyx_t_4 = (__pyx_v_bin0 <= 0);
      if (__pyx_t_4) {

     202:         bin0 = 1

        /* "histogram.pyx":202
     *         bin0 = bin1 = < long > bins
     *     if bin0 <= 0:
     *         bin0 = 1             # <<<<<<<<<<<<<<
     *     if bin1 <= 0:
     *         bin1 = 1
     */
        __pyx_v_bin0 = 1;
        goto __pyx_L15;
      }
      __pyx_L15:;

     203:     if bin1 <= 0:

      /* "histogram.pyx":203
     *     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) {

     204:         bin1 = 1

        /* "histogram.pyx":204
     *         bin0 = 1
     *     if bin1 <= 0:
     *         bin1 = 1             # <<<<<<<<<<<<<<
     *     cdef int csplit = split
     *     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)
     */
        __pyx_v_bin1 = 1;
        goto __pyx_L16;
      }
      __pyx_L16:;

     205:     cdef int csplit = split

      /* "histogram.pyx":205
     *     if bin1 <= 0:
     *         bin1 = 1
     *     cdef int csplit = split             # <<<<<<<<<<<<<<
     *     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)
     *     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
     */
      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_split); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_csplit = __pyx_t_12;

     206:     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)

      /* "histogram.pyx":206
     *         bin1 = 1
     *     cdef int csplit = split
     *     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)             # <<<<<<<<<<<<<<
     *     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
     *     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__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 = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_13);
      if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_v_cpos0 = __pyx_t_14;
      __pyx_t_14.memview = NULL;
      __pyx_t_14.data = NULL;

     207:     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)

      /* "histogram.pyx":207
     *     cdef int csplit = split
     *     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)
     *     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)             # <<<<<<<<<<<<<<
     *     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
     */
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_13, 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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_9);
      if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_cpos1 = __pyx_t_15;
      __pyx_t_15.memview = NULL;
      __pyx_t_15.data = NULL;

     208:     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)

      /* "histogram.pyx":208
     *     cdef double[:] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float64)
     *     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
     *     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
     */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_13 = 0;
      __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __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_9)); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3);
      if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_data = __pyx_t_16;
      __pyx_t_16.memview = NULL;
      __pyx_t_16.data = NULL;

     209:     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")

      /* "histogram.pyx":209
     *     cdef double[:] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
     *     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __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 = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 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 = 209; __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 = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 209; __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_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          __pyx_v_outData = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outData.diminfo[0].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData.diminfo[0].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outData.diminfo[1].strides = __pyx_pybuffernd_outData.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outData.diminfo[1].shape = __pyx_pybuffernd_outData.rcbuffer->pybuffer.shape[1];
        }
      }
      __pyx_t_17 = 0;
      __pyx_v_outData = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

     210:     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")

      /* "histogram.pyx":210
     *     cdef double[:] data = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float64)
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0, edges1
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
      __pyx_t_13 = 0;
      __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
      if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_18 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          __pyx_v_outCount = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outCount.diminfo[0].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount.diminfo[0].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outCount.diminfo[1].strides = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outCount.diminfo[1].shape = __pyx_pybuffernd_outCount.rcbuffer->pybuffer.shape[1];
        }
      }
      __pyx_t_18 = 0;
      __pyx_v_outCount = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

     211:     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")

      /* "histogram.pyx":211
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")             # <<<<<<<<<<<<<<
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0, edges1
     *     cdef double min0 = pos0.min()
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 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 = 211; __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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_19 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_outMerge.diminfo[0].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge.diminfo[0].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMerge.diminfo[1].strides = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMerge.diminfo[1].shape = __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.shape[1];
        }
      }
      __pyx_t_19 = 0;
      __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

     212:     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0, edges1

     213:     cdef double min0 = pos0.min()

      /* "histogram.pyx":213
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bin0, bin1), dtype="float64")
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0, edges1
     *     cdef double min0 = pos0.min()             # <<<<<<<<<<<<<<
     *     cdef double max0 = pos0.max() * EPS32
     *     cdef double min1 = pos1.min()
     */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_min0 = __pyx_t_20;

     214:     cdef double max0 = pos0.max() * EPS32

      /* "histogram.pyx":214
     *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0, edges1
     *     cdef double min0 = pos0.min()
     *     cdef double max0 = pos0.max() * EPS32             # <<<<<<<<<<<<<<
     *     cdef double min1 = pos1.min()
     *     cdef double max1 = pos1.max() * EPS32
     */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__max); 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_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); 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_9 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_max0 = __pyx_t_20;

     215:     cdef double min1 = pos1.min()

      /* "histogram.pyx":215
     *     cdef double min0 = pos0.min()
     *     cdef double max0 = pos0.max() * EPS32
     *     cdef double min1 = pos1.min()             # <<<<<<<<<<<<<<
     *     cdef double max1 = pos1.max() * EPS32
     *     cdef double idp0 = (< double > bin0) / (max0 - min0)
     */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__min); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_min1 = __pyx_t_20;

     216:     cdef double max1 = pos1.max() * EPS32

      /* "histogram.pyx":216
     *     cdef double max0 = pos0.max() * EPS32
     *     cdef double min1 = pos1.min()
     *     cdef double max1 = pos1.max() * EPS32             # <<<<<<<<<<<<<<
     *     cdef double idp0 = (< double > bin0) / (max0 - min0)
     *     cdef double idp1 = (< double > bin1) / (max1 - min1)
     */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__max); 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_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); 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_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_1); 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_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_max1 = __pyx_t_20;

     217:     cdef double idp0 = (< double > bin0) / (max0 - min0)

      /* "histogram.pyx":217
     *     cdef double min1 = pos1.min()
     *     cdef double max1 = pos1.max() * EPS32
     *     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));

     218:     cdef double idp1 = (< double > bin1) / (max1 - min1)

      /* "histogram.pyx":218
     *     cdef double max1 = pos1.max() * EPS32
     *     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));

     219:     cdef double dbin0 = 0.5, dbin1 = 0.5

      /* "histogram.pyx":219
     *     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
     *     cdef double epsilon = 1e-10
     */
      __pyx_v_dbin0 = 0.5;
      __pyx_v_dbin1 = 0.5;

     220:     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera

     221:     cdef double epsilon = 1e-10

      /* "histogram.pyx":221
     *     cdef double dbin0 = 0.5, dbin1 = 0.5
     *     cdef double fbin0, fbin1, p0, p1, d, rest, delta0l, delta0r, delta1l, delta1r, aera
     *     cdef double epsilon = 1e-10             # <<<<<<<<<<<<<<
     *
     *     edges0 = numpy.linspace(min0+(0.5/idp0),max0-(0.5/idp0),bin0)
     */
      __pyx_v_epsilon = 1e-10;

     222:

     223:     edges0 = numpy.linspace(min0+(0.5/idp0),max0-(0.5/idp0),bin0)

      /* "histogram.pyx":223
     *     cdef double epsilon = 1e-10
     *
     *     edges0 = numpy.linspace(min0+(0.5/idp0),max0-(0.5/idp0),bin0)             # <<<<<<<<<<<<<<
     *     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)
     *     if nthread is not None:
     */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__linspace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble((__pyx_v_min0 + (0.5 / __pyx_v_idp0))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyFloat_FromDouble((__pyx_v_max0 - (0.5 / __pyx_v_idp0))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_13 = PyInt_FromLong(__pyx_v_bin0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_21 = ((PyArrayObject *)__pyx_t_13);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer);
        __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_12 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer, (PyObject*)__pyx_v_edges0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
        }
        __pyx_pybuffernd_edges0.diminfo[0].strides = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges0.diminfo[0].shape = __pyx_pybuffernd_edges0.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_21 = 0;
      __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_13);
      __pyx_t_13 = 0;

     224:     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)

      /* "histogram.pyx":224
     *
     *     edges0 = numpy.linspace(min0+(0.5/idp0),max0-(0.5/idp0),bin0)
     *     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)             # <<<<<<<<<<<<<<
     *     if nthread is not None:
     *         if isinstance(nthread, int) and (nthread > 0):
     */
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__linspace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyFloat_FromDouble((__pyx_v_min1 + (0.5 / __pyx_v_idp1))); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_1 = PyFloat_FromDouble((__pyx_v_max1 - (0.5 / __pyx_v_idp1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyInt_FromLong(__pyx_v_bin1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_13 = 0;
      __pyx_t_1 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_21 = ((PyArrayObject *)__pyx_t_9);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer);
        __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_12 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer, (PyObject*)__pyx_v_edges1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
        }
        __pyx_pybuffernd_edges1.diminfo[0].strides = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges1.diminfo[0].shape = __pyx_pybuffernd_edges1.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_21 = 0;
      __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_9);
      __pyx_t_9 = 0;

     225:     if nthread is not None:

      /* "histogram.pyx":225
     *     edges0 = numpy.linspace(min0+(0.5/idp0),max0-(0.5/idp0),bin0)
     *     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)
     *     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) {

     226:         if isinstance(nthread, int) and (nthread > 0):

        /* "histogram.pyx":226
     *     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)
     *     if nthread is not None:
     *         if isinstance(nthread, int) and (nthread > 0):             # <<<<<<<<<<<<<<
     *             omp_set_num_threads(< int > nthread)
     *     with nogil:
     */
        __pyx_t_4 = PyInt_Check(__pyx_v_nthread);
        if (__pyx_t_4) {
          __pyx_t_9 = PyObject_RichCompare(__pyx_v_nthread, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_22 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_23 = __pyx_t_22;
        } else {
          __pyx_t_23 = __pyx_t_4;
        }
        if (__pyx_t_23) {

     227:             omp_set_num_threads(< int > nthread)

          /* "histogram.pyx":227
     *     if nthread is not None:
     *         if isinstance(nthread, int) and (nthread > 0):
     *             omp_set_num_threads(< int > nthread)             # <<<<<<<<<<<<<<
     *     with nogil:
     *         for i in range(size):
     */
          __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_nthread); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          omp_set_num_threads(((int)__pyx_t_12));
          goto __pyx_L18;
        }
        __pyx_L18:;
        goto __pyx_L17;
      }
      __pyx_L17:;

     228:     with nogil:

      /* "histogram.pyx":228
     *         if isinstance(nthread, int) and (nthread > 0):
     *             omp_set_num_threads(< int > nthread)
     *     with nogil:             # <<<<<<<<<<<<<<
     *         for i in range(size):
     *             p0 = cpos0[i]
     */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

          /* "histogram.pyx":228
     *         if isinstance(nthread, int) and (nthread > 0):
     *             omp_set_num_threads(< int > nthread)
     *     with nogil:             # <<<<<<<<<<<<<<
     *         for i in range(size):
     *             p0 = cpos0[i]
     */
          /*finally:*/ {
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
          }
      }

     229:         for i in range(size):

            /* "histogram.pyx":229
     *             omp_set_num_threads(< int > nthread)
     *     with nogil:
     *         for i in range(size):             # <<<<<<<<<<<<<<
     *             p0 = cpos0[i]
     *             p1 = cpos1[i]
     */
            __pyx_t_11 = __pyx_v_size;
            for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_11; __pyx_t_5+=1) {
              __pyx_v_i = __pyx_t_5;

     230:             p0 = cpos0[i]

              /* "histogram.pyx":230
     *     with nogil:
     *         for i in range(size):
     *             p0 = cpos0[i]             # <<<<<<<<<<<<<<
     *             p1 = cpos1[i]
     *             d = data[i]
     */
              __pyx_t_24 = __pyx_v_i;
              __pyx_v_p0 = (*((double *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_24 * __pyx_v_cpos0.strides[0]) )));

     231:             p1 = cpos1[i]

              /* "histogram.pyx":231
     *         for i in range(size):
     *             p0 = cpos0[i]
     *             p1 = cpos1[i]             # <<<<<<<<<<<<<<
     *             d = data[i]
     *             fbin0 = (p0 - min0) * idp0
     */
              __pyx_t_25 = __pyx_v_i;
              __pyx_v_p1 = (*((double *) ( /* dim=0 */ (__pyx_v_cpos1.data + __pyx_t_25 * __pyx_v_cpos1.strides[0]) )));

     232:             d = data[i]

              /* "histogram.pyx":232
     *             p0 = cpos0[i]
     *             p1 = cpos1[i]
     *             d = data[i]             # <<<<<<<<<<<<<<
     *             fbin0 = (p0 - min0) * idp0
     *             fbin1 = (p1 - min1) * idp1
     */
              __pyx_t_26 = __pyx_v_i;
              __pyx_v_d = (*((double *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_26 * __pyx_v_data.strides[0]) )));

     233:             fbin0 = (p0 - min0) * idp0

              /* "histogram.pyx":233
     *             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);

     234:             fbin1 = (p1 - min1) * idp1

              /* "histogram.pyx":234
     *             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);

     235:             b0 = < long > floor(fbin0)

              /* "histogram.pyx":235
     *             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));

     236:             b1 = < long > floor(fbin1)

              /* "histogram.pyx":236
     *             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));

     237:             if b0 == bin0:

              /* "histogram.pyx":237
     *             b0 = < long > floor(fbin0)
     *             b1 = < long > floor(fbin1)
     *             if b0 == bin0:             # <<<<<<<<<<<<<<
     *                 b0 = bin0 - 1
     *                 fbin0 = (< double > bin0) - 0.5
     */
              __pyx_t_23 = (__pyx_v_b0 == __pyx_v_bin0);
              if (__pyx_t_23) {

     238:                 b0 = bin0 - 1

                /* "histogram.pyx":238
     *             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);

     239:                 fbin0 = (< double > bin0) - 0.5

                /* "histogram.pyx":239
     *             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_L24;
              }

     240:             elif b0 == 0:

              /* "histogram.pyx":240
     *                 b0 = bin0 - 1
     *                 fbin0 = (< double > bin0) - 0.5
     *             elif b0 == 0:             # <<<<<<<<<<<<<<
     *                 fbin0 = 0.5
     *             if b1 == bin1:
     */
              __pyx_t_23 = (__pyx_v_b0 == 0);
              if (__pyx_t_23) {

     241:                 fbin0 = 0.5

                /* "histogram.pyx":241
     *                 fbin0 = (< double > bin0) - 0.5
     *             elif b0 == 0:
     *                 fbin0 = 0.5             # <<<<<<<<<<<<<<
     *             if b1 == bin1:
     *                 b1 = bin1 - 1
     */
                __pyx_v_fbin0 = 0.5;
                goto __pyx_L24;
              }
              __pyx_L24:;

     242:             if b1 == bin1:

              /* "histogram.pyx":242
     *             elif b0 == 0:
     *                 fbin0 = 0.5
     *             if b1 == bin1:             # <<<<<<<<<<<<<<
     *                 b1 = bin1 - 1
     *                 fbin1 = (< double > bin1) - 0.5
     */
              __pyx_t_23 = (__pyx_v_b1 == __pyx_v_bin1);
              if (__pyx_t_23) {

     243:                 b1 = bin1 - 1

                /* "histogram.pyx":243
     *                 fbin0 = 0.5
     *             if b1 == bin1:
     *                 b1 = bin1 - 1             # <<<<<<<<<<<<<<
     *                 fbin1 = (< double > bin1) - 0.5
     *             elif b1 == 0:
     */
                __pyx_v_b1 = (__pyx_v_bin1 - 1);

     244:                 fbin1 = (< double > bin1) - 0.5

                /* "histogram.pyx":244
     *             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_L25;
              }

     245:             elif b1 == 0:

              /* "histogram.pyx":245
     *                 b1 = bin1 - 1
     *                 fbin1 = (< double > bin1) - 0.5
     *             elif b1 == 0:             # <<<<<<<<<<<<<<
     *                 fbin1 = 0.5
     *
     */
              __pyx_t_23 = (__pyx_v_b1 == 0);
              if (__pyx_t_23) {

     246:                 fbin1 = 0.5

                /* "histogram.pyx":246
     *                 fbin1 = (< double > bin1) - 0.5
     *             elif b1 == 0:
     *                 fbin1 = 0.5             # <<<<<<<<<<<<<<
     *
     *             delta0l = fbin0 -< double > b0 - dbin0
     */
                __pyx_v_fbin1 = 0.5;
                goto __pyx_L25;
              }
              __pyx_L25:;

     247:

     248:             delta0l = fbin0 -< double > b0 - dbin0

              /* "histogram.pyx":248
     *                 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);

     249:             delta0r = fbin0 -< double > b0 - 1 + dbin0

              /* "histogram.pyx":249
     *
     *             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);

     250:             delta1l = fbin1 -< double > b1 - dbin1

              /* "histogram.pyx":250
     *             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);

     251:             delta1r = fbin1 -< double > b1 - 1 + dbin1

              /* "histogram.pyx":251
     *             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);

     252:             rest = 1.0

              /* "histogram.pyx":252
     *             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;

     253:             if csplit == 1:

              /* "histogram.pyx":253
     *             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_23 = (__pyx_v_csplit == 1);
              if (__pyx_t_23) {

     254:                 if delta0l < 0 and b0 > 0:

                /* "histogram.pyx":254
     *             rest = 1.0
     *             if csplit == 1:
     *                 if delta0l < 0 and b0 > 0:             # <<<<<<<<<<<<<<
     *                     if delta1l < 0 and b1 > 0:
     *                         area = delta0l * delta1l
     */
                __pyx_t_23 = (__pyx_v_delta0l < 0.0);
                if (__pyx_t_23) {
                  __pyx_t_4 = (__pyx_v_b0 > 0);
                  __pyx_t_22 = __pyx_t_4;
                } else {
                  __pyx_t_22 = __pyx_t_23;
                }
                if (__pyx_t_22) {

     255:                     if delta1l < 0 and b1 > 0:

                  /* "histogram.pyx":255
     *             if csplit == 1:
     *                 if delta0l < 0 and b0 > 0:
     *                     if delta1l < 0 and b1 > 0:             # <<<<<<<<<<<<<<
     *                         area = delta0l * delta1l
     *                         rest -= area
     */
                  __pyx_t_22 = (__pyx_v_delta1l < 0.0);
                  if (__pyx_t_22) {
                    __pyx_t_23 = (__pyx_v_b1 > 0);
                    __pyx_t_4 = __pyx_t_23;
                  } else {
                    __pyx_t_4 = __pyx_t_22;
                  }
                  if (__pyx_t_4) {

     256:                         area = delta0l * delta1l

                    /* "histogram.pyx":256
     *                 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);

     257:                         rest -= area

                    /* "histogram.pyx":257
     *                     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);

     258:                         outCount[b0 - 1, b1 - 1] += area

                    /* "histogram.pyx":258
     *                         area = delta0l * delta1l
     *                         rest -= area
     *                         outCount[b0 - 1, b1 - 1] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 - 1, b1 - 1] += area * d
     *
     */
                    __pyx_t_27 = (__pyx_v_b0 - 1);
                    __pyx_t_28 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     259:                         outData[b0 - 1, b1 - 1] += area * d

                    /* "histogram.pyx":259
     *                         rest -= area
     *                         outCount[b0 - 1, b1 - 1] += area
     *                         outData[b0 - 1, b1 - 1] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (-delta0l) * (1 + delta1l)
     */
                    __pyx_t_29 = (__pyx_v_b0 - 1);
                    __pyx_t_30 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     260:

     261:                         area = (-delta0l) * (1 + delta1l)

                    /* "histogram.pyx":261
     *                         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));

     262:                         rest -= area

                    /* "histogram.pyx":262
     *
     *                         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);

     263:                         outCount[b0 - 1, b1 ] += area

                    /* "histogram.pyx":263
     *                         area = (-delta0l) * (1 + delta1l)
     *                         rest -= area
     *                         outCount[b0 - 1, b1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 - 1, b1 ] += area * d
     *
     */
                    __pyx_t_31 = (__pyx_v_b0 - 1);
                    __pyx_t_32 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     264:                         outData[b0 - 1, b1 ] += area * d

                    /* "histogram.pyx":264
     *                         rest -= area
     *                         outCount[b0 - 1, b1 ] += area
     *                         outData[b0 - 1, b1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (1 + delta0l) * (-delta1l)
     */
                    __pyx_t_33 = (__pyx_v_b0 - 1);
                    __pyx_t_34 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     265:

     266:                         area = (1 + delta0l) * (-delta1l)

                    /* "histogram.pyx":266
     *                         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));

     267:                         rest -= area

                    /* "histogram.pyx":267
     *
     *                         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);

     268:                         outCount[b0 , b1 - 1 ] += area

                    /* "histogram.pyx":268
     *                         area = (1 + delta0l) * (-delta1l)
     *                         rest -= area
     *                         outCount[b0 , b1 - 1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 , b1 - 1 ] += area * d
     *
     */
                    __pyx_t_35 = __pyx_v_b0;
                    __pyx_t_36 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     269:                         outData[b0 , b1 - 1 ] += area * d

                    /* "histogram.pyx":269
     *                         rest -= area
     *                         outCount[b0 , b1 - 1 ] += area
     *                         outData[b0 , b1 - 1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                     elif delta1r > 0 and b1 < bin1 - 1:
     */
                    __pyx_t_37 = __pyx_v_b0;
                    __pyx_t_38 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);
                    goto __pyx_L28;
                  }

     270:

     271:                     elif delta1r > 0 and b1 < bin1 - 1:

                  /* "histogram.pyx":271
     *                         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_22 = (__pyx_v_b1 < (__pyx_v_bin1 - 1));
                    __pyx_t_23 = __pyx_t_22;
                  } else {
                    __pyx_t_23 = __pyx_t_4;
                  }
                  if (__pyx_t_23) {

     272:                         area = -delta0l * delta1r

                    /* "histogram.pyx":272
     *
     *                     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);

     273:                         rest -= area

                    /* "histogram.pyx":273
     *                     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);

     274:                         outCount[b0 - 1, b1 + 1] += area

                    /* "histogram.pyx":274
     *                         area = -delta0l * delta1r
     *                         rest -= area
     *                         outCount[b0 - 1, b1 + 1] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 - 1, b1 + 1] += area * d
     *
     */
                    __pyx_t_39 = (__pyx_v_b0 - 1);
                    __pyx_t_40 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     275:                         outData[b0 - 1, b1 + 1] += area * d

                    /* "histogram.pyx":275
     *                         rest -= area
     *                         outCount[b0 - 1, b1 + 1] += area
     *                         outData[b0 - 1, b1 + 1] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (-delta0l) * (1 - delta1r)
     */
                    __pyx_t_41 = (__pyx_v_b0 - 1);
                    __pyx_t_42 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     276:

     277:                         area = (-delta0l) * (1 - delta1r)

                    /* "histogram.pyx":277
     *                         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));

     278:                         rest -= area

                    /* "histogram.pyx":278
     *
     *                         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);

     279:                         outCount[b0 - 1, b1 ] += area

                    /* "histogram.pyx":279
     *                         area = (-delta0l) * (1 - delta1r)
     *                         rest -= area
     *                         outCount[b0 - 1, b1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 - 1, b1 ] += area * d
     *
     */
                    __pyx_t_43 = (__pyx_v_b0 - 1);
                    __pyx_t_44 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     280:                         outData[b0 - 1, b1 ] += area * d

                    /* "histogram.pyx":280
     *                         rest -= area
     *                         outCount[b0 - 1, b1 ] += area
     *                         outData[b0 - 1, b1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (1 + delta0l) * (delta1r)
     */
                    __pyx_t_45 = (__pyx_v_b0 - 1);
                    __pyx_t_46 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     281:

     282:                         area = (1 + delta0l) * (delta1r)

                    /* "histogram.pyx":282
     *                         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);

     283:                         rest -= area

                    /* "histogram.pyx":283
     *
     *                         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);

     284:                         outCount[b0 , b1 + 1 ] += area

                    /* "histogram.pyx":284
     *                         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_47 = __pyx_v_b0;
                    __pyx_t_48 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     285:                         outData[b0 , b1 + 1 ] += area * d

                    /* "histogram.pyx":285
     *                         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_49 = __pyx_v_b0;
                    __pyx_t_50 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);
                    goto __pyx_L28;
                  }
                  __pyx_L28:;
                  goto __pyx_L27;
                }

     286:                 elif delta0r > 0 and b0 < bin0 - 1:

                /* "histogram.pyx":286
     *                         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_23 = (__pyx_v_delta0r > 0.0);
                if (__pyx_t_23) {
                  __pyx_t_4 = (__pyx_v_b0 < (__pyx_v_bin0 - 1));
                  __pyx_t_22 = __pyx_t_4;
                } else {
                  __pyx_t_22 = __pyx_t_23;
                }
                if (__pyx_t_22) {

     287:                     if delta1l < 0 and b1 > 0:

                  /* "histogram.pyx":287
     *                         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_22 = (__pyx_v_delta1l < 0.0);
                  if (__pyx_t_22) {
                    __pyx_t_23 = (__pyx_v_b1 > 0);
                    __pyx_t_4 = __pyx_t_23;
                  } else {
                    __pyx_t_4 = __pyx_t_22;
                  }
                  if (__pyx_t_4) {

     288:                         area = -delta0r * delta1l

                    /* "histogram.pyx":288
     *                 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);

     289:                         rest -= area

                    /* "histogram.pyx":289
     *                     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);

     290:                         outCount[b0 + 1, b1 - 1] += area

                    /* "histogram.pyx":290
     *                         area = -delta0r * delta1l
     *                         rest -= area
     *                         outCount[b0 + 1, b1 - 1] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 + 1, b1 - 1] += area * d
     *
     */
                    __pyx_t_51 = (__pyx_v_b0 + 1);
                    __pyx_t_52 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     291:                         outData[b0 + 1, b1 - 1] += area * d

                    /* "histogram.pyx":291
     *                         rest -= area
     *                         outCount[b0 + 1, b1 - 1] += area
     *                         outData[b0 + 1, b1 - 1] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (delta0r) * (1 + delta1l)
     */
                    __pyx_t_53 = (__pyx_v_b0 + 1);
                    __pyx_t_54 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_54, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     292:

     293:                         area = (delta0r) * (1 + delta1l)

                    /* "histogram.pyx":293
     *                         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));

     294:                         rest -= area

                    /* "histogram.pyx":294
     *
     *                         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);

     295:                         outCount[b0 + 1, b1 ] += area

                    /* "histogram.pyx":295
     *                         area = (delta0r) * (1 + delta1l)
     *                         rest -= area
     *                         outCount[b0 + 1, b1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 + 1, b1 ] += area * d
     *
     */
                    __pyx_t_55 = (__pyx_v_b0 + 1);
                    __pyx_t_56 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     296:                         outData[b0 + 1, b1 ] += area * d

                    /* "histogram.pyx":296
     *                         rest -= area
     *                         outCount[b0 + 1, b1 ] += area
     *                         outData[b0 + 1, b1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (1 - delta0r) * (-delta1l)
     */
                    __pyx_t_57 = (__pyx_v_b0 + 1);
                    __pyx_t_58 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     297:

     298:                         area = (1 - delta0r) * (-delta1l)

                    /* "histogram.pyx":298
     *                         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));

     299:                         rest -= area

                    /* "histogram.pyx":299
     *
     *                         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);

     300:                         outCount[b0 , b1 - 1 ] += area

                    /* "histogram.pyx":300
     *                         area = (1 - delta0r) * (-delta1l)
     *                         rest -= area
     *                         outCount[b0 , b1 - 1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 , b1 - 1 ] += area * d
     *
     */
                    __pyx_t_59 = __pyx_v_b0;
                    __pyx_t_60 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     301:                         outData[b0 , b1 - 1 ] += area * d

                    /* "histogram.pyx":301
     *                         rest -= area
     *                         outCount[b0 , b1 - 1 ] += area
     *                         outData[b0 , b1 - 1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                     elif delta1r > 0 and b1 < bin1 - 1:
     */
                    __pyx_t_61 = __pyx_v_b0;
                    __pyx_t_62 = (__pyx_v_b1 - 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);
                    goto __pyx_L29;
                  }

     302:

     303:                     elif delta1r > 0 and b1 < bin1 - 1:

                  /* "histogram.pyx":303
     *                         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_22 = (__pyx_v_b1 < (__pyx_v_bin1 - 1));
                    __pyx_t_23 = __pyx_t_22;
                  } else {
                    __pyx_t_23 = __pyx_t_4;
                  }
                  if (__pyx_t_23) {

     304:                         area = delta0r * delta1r

                    /* "histogram.pyx":304
     *
     *                     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);

     305:                         rest -= area

                    /* "histogram.pyx":305
     *                     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);

     306:                         outCount[b0 + 1, b1 + 1] += area

                    /* "histogram.pyx":306
     *                         area = delta0r * delta1r
     *                         rest -= area
     *                         outCount[b0 + 1, b1 + 1] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 + 1, b1 + 1] += area * d
     *
     */
                    __pyx_t_63 = (__pyx_v_b0 + 1);
                    __pyx_t_64 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     307:                         outData[b0 + 1, b1 + 1] += area * d

                    /* "histogram.pyx":307
     *                         rest -= area
     *                         outCount[b0 + 1, b1 + 1] += area
     *                         outData[b0 + 1, b1 + 1] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (delta0r) * (1 - delta1r)
     */
                    __pyx_t_65 = (__pyx_v_b0 + 1);
                    __pyx_t_66 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     308:

     309:                         area = (delta0r) * (1 - delta1r)

                    /* "histogram.pyx":309
     *                         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));

     310:                         rest -= area

                    /* "histogram.pyx":310
     *
     *                         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);

     311:                         outCount[b0 + 1, b1 ] += area

                    /* "histogram.pyx":311
     *                         area = (delta0r) * (1 - delta1r)
     *                         rest -= area
     *                         outCount[b0 + 1, b1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 + 1, b1 ] += area * d
     *
     */
                    __pyx_t_67 = (__pyx_v_b0 + 1);
                    __pyx_t_68 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     312:                         outData[b0 + 1, b1 ] += area * d

                    /* "histogram.pyx":312
     *                         rest -= area
     *                         outCount[b0 + 1, b1 ] += area
     *                         outData[b0 + 1, b1 ] += area * d             # <<<<<<<<<<<<<<
     *
     *                         area = (1 - delta0r) * (delta1r)
     */
                    __pyx_t_69 = (__pyx_v_b0 + 1);
                    __pyx_t_70 = __pyx_v_b1;
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);

     313:

     314:                         area = (1 - delta0r) * (delta1r)

                    /* "histogram.pyx":314
     *                         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);

     315:                         rest -= area

                    /* "histogram.pyx":315
     *
     *                         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);

     316:                         outCount[b0 , b1 + 1 ] += area

                    /* "histogram.pyx":316
     *                         area = (1 - delta0r) * (delta1r)
     *                         rest -= area
     *                         outCount[b0 , b1 + 1 ] += area             # <<<<<<<<<<<<<<
     *                         outData[b0 , b1 + 1 ] += area * d
     *             outCount[b0, b1] += rest
     */
                    __pyx_t_71 = __pyx_v_b0;
                    __pyx_t_72 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_area;

     317:                         outData[b0 , b1 + 1 ] += area * d

                    /* "histogram.pyx":317
     *                         rest -= area
     *                         outCount[b0 , b1 + 1 ] += area
     *                         outData[b0 , b1 + 1 ] += area * d             # <<<<<<<<<<<<<<
     *             outCount[b0, b1] += rest
     *             outData[b0, b1] += d * rest
     */
                    __pyx_t_73 = __pyx_v_b0;
                    __pyx_t_74 = (__pyx_v_b1 + 1);
                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_74, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_area * __pyx_v_d);
                    goto __pyx_L29;
                  }
                  __pyx_L29:;
                  goto __pyx_L27;
                }
                __pyx_L27:;
                goto __pyx_L26;
              }
              __pyx_L26:;

     318:             outCount[b0, b1] += rest

              /* "histogram.pyx":318
     *                         outCount[b0 , b1 + 1 ] += area
     *                         outData[b0 , b1 + 1 ] += area * d
     *             outCount[b0, b1] += rest             # <<<<<<<<<<<<<<
     *             outData[b0, b1] += d * rest
     *
     */
              __pyx_t_75 = __pyx_v_b0;
              __pyx_t_76 = __pyx_v_b1;
              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_rest;

     319:             outData[b0, b1] += d * rest

              /* "histogram.pyx":319
     *                         outData[b0 , b1 + 1 ] += area * d
     *             outCount[b0, b1] += rest
     *             outData[b0, b1] += d * rest             # <<<<<<<<<<<<<<
     *
     *         for i in prange(bin0):
     */
              __pyx_t_77 = __pyx_v_b0;
              __pyx_t_78 = __pyx_v_b1;
              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_78, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_d * __pyx_v_rest);
            }

     320:

     321:         for i in prange(bin0):

            /* "histogram.pyx":321
     *             outData[b0, b1] += d * rest
     *
     *         for i in prange(bin0):             # <<<<<<<<<<<<<<
     *             for j in range(bin1):
     *                 if outCount[i, j] > epsilon:
     */
            __pyx_t_11 = __pyx_v_bin0;
            if (1 == 0) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_79 = (__pyx_t_11 - 0) / 1;
                if (__pyx_t_79 > 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_79; __pyx_t_5++){
                            {
                                __pyx_v_i = 0 + 1 * __pyx_t_5;
                                /* Initialize private variables to invalid values */
                                __pyx_v_j = ((long)0xbad0bad0);

     322:             for j in range(bin1):

                                /* "histogram.pyx":322
     *
     *         for i in prange(bin0):
     *             for j in range(bin1):             # <<<<<<<<<<<<<<
     *                 if outCount[i, j] > epsilon:
     *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
     */
                                __pyx_t_80 = __pyx_v_bin1;
                                for (__pyx_t_81 = 0; __pyx_t_81 < __pyx_t_80; __pyx_t_81+=1) {
                                  __pyx_v_j = __pyx_t_81;

     323:                 if outCount[i, j] > epsilon:

                                  /* "histogram.pyx":323
     *         for i in prange(bin0):
     *             for j in range(bin1):
     *                 if outCount[i, j] > epsilon:             # <<<<<<<<<<<<<<
     *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
     *                 else:
     */
                                  __pyx_t_82 = __pyx_v_i;
                                  __pyx_t_83 = __pyx_v_j;
                                  __pyx_t_23 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon);
                                  if (__pyx_t_23) {

     324:                     outMerge[i, j] += outData[i, j] / outCount[i, j]

                                    /* "histogram.pyx":324
     *             for j in range(bin1):
     *                 if outCount[i, j] > epsilon:
     *                     outMerge[i, j] += outData[i, j] / outCount[i, j]             # <<<<<<<<<<<<<<
     *                 else:
     *                     outMerge[i, j] += dummy
     */
                                    __pyx_t_84 = __pyx_v_i;
                                    __pyx_t_85 = __pyx_v_j;
                                    __pyx_t_86 = __pyx_v_i;
                                    __pyx_t_87 = __pyx_v_j;
                                    __pyx_t_88 = __pyx_v_i;
                                    __pyx_t_89 = __pyx_v_j;
                                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_88, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_89, __pyx_pybuffernd_outMerge.diminfo[1].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_outCount.diminfo[1].strides)));
                                    goto __pyx_L36;
                                  }
                                  /*else*/ {

     325:                 else:

     326:                     outMerge[i, j] += dummy

                                    /* "histogram.pyx":326
     *                     outMerge[i, j] += outData[i, j] / outCount[i, j]
     *                 else:
     *                     outMerge[i, j] += dummy             # <<<<<<<<<<<<<<
     *
     *
     */
                                    __pyx_t_90 = __pyx_v_i;
                                    __pyx_t_91 = __pyx_v_j;
                                    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_91, __pyx_pybuffernd_outMerge.diminfo[1].strides) += __pyx_v_dummy;
                                  }
                                  __pyx_L36:;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     327:

     328:

     329:     return outMerge, edges0, edges1, outData, outCount

      /* "histogram.pyx":329
     *
     *
     *     return outMerge, edges0, edges1, outData, outCount             # <<<<<<<<<<<<<<
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(((PyObject *)__pyx_v_outMerge));
      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_outMerge));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
      __Pyx_INCREF(((PyObject *)__pyx_v_edges0));
      PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_edges0));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_edges0));
      __Pyx_INCREF(((PyObject *)__pyx_v_edges1));
      PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_v_edges1));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_edges1));
      __Pyx_INCREF(((PyObject *)__pyx_v_outData));
      PyTuple_SET_ITEM(__pyx_t_9, 3, ((PyObject *)__pyx_v_outData));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
      __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
      PyTuple_SET_ITEM(__pyx_t_9, 4, ((PyObject *)__pyx_v_outCount));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
      __pyx_r = ((PyObject *)__pyx_t_9);
      __pyx_t_9 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_13);
      __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges0.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
      __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_pybuffernd_edges0.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges1.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
      __pyx_L2:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_data, 1);
      __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;
    }

    /* Python wrapper */
    static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
    static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }